Introduction

Congratulations! You have decided to embark on learning Visual Basic .NET.

This is an exciting time for Visual Basic programmers. Visual Basic .NET is a different animal from its predecessors. Even if you have been programming with Visual Basic for years, there is suddenly a lot of new stuff to learn. From a totally redesigned user interface to new language features and architectural changes, Visual Basic .NET represents an evolutionary step forward. Visual Basic has always made it easy to develop Windows programs, and Visual Basic .NET continues that tradition. However, the .NET framework was created clearly with Internet application development in mind. With the latest version of VB, you can create Web applications using the Visual Basic forms programming model and deploy them, all from within the Visual Studio .NET environment.

The Visual Basic language has been improved as well. Not only does it support new programming features (such as inheritance), but the language itself also shares a common foundation with other Visual Studio .NET languages. This fact, along with the wealth of new programming functionality provided by the .NET framework, really levels the playing field between the capabilities of Visual Basic and C++.

Okay, so now you are excited about learning Visual Basic. Your next question is, “What will this book do for me?”

Who Should Read This Book

We feel that this book has something to offer for all skill levels. If you have never used Visual Basic before, the initial chapters provide the necessary step-by-step instructions to get you used to the Visual Studio programming environment. Users of previous versions of Visual Basic (experienced or not) will appreciate extensive, detailed coverage of the new features available in VB .NET and explanations of the changes from previous versions. Readers who are new to computer programming in general should note that technical details are sprinkled with “words of wisdom” and real-world examples to help you understand new concepts. We make very few assumptions about our readers, other than the following:

  • Readers should already be familiar with the Microsoft Windows operating system. Although the examples in this book were developed using Windows 2000, any recent Windows operating system will do.

  • Readers should know how to start applications on the system, browse the Web, as well as copy and download files. In other words, they are “power users” of their computer.

  • Readers should have a general idea of some of the different categories of computer programs commonly available; that is, a word processing program or spreadsheet.

  • Finally, readers should have an open mind and be eager to learn!

How This Book Is Organized

Computer programming books can serve different audiences. Some readers may need a reference to find information about a particular topic quickly. Other readers might want to follow the book in tutorial style by reading each chapter start to finish. Readers of Special Edition Using Visual Basic .NET should be able do either. Each topic is explained in a narrative fashion, with lists, pictures, and sample code to allow the reader to quickly absorb the technical details. For those seeking instant gratification, many chapters include exercises that provide step-by-step instructions to try out a particular topic on your own. Special Edition Using Visual Basic .NET is divided into six parts and a section of appendices.

Getting Started with Visual Basic .NET

If you’re enthusiastic about learning how to program, one of the best ways to remain so is to see results quickly. That’s why we’ve targeted the first section of this book at the new-to-.NET developer. If you have never used Visual Basic before, the introductory chapters will provide real experiences you can keep in mind to better understand other topics. If you are already an experienced user of a previous version of Visual Basic, this section should give you a good feel for what has changed in the .NET world.

Chapter 1, “Introduction to Visual Basic .NET,” discusses some general programming concepts and high-level design strategies. As you will learn, design is very important in creating a successful application.

In Chapter 2, “Creating Your First Windows Application,” you work step-by-step through the process of building a fully functional application in Visual Basic.

Chapter 3, “Creating Your First Web Application,” walks you through setting up an interactive Web site using Visual Basic .NET.

Chapter 4, “Understanding the Development Environment,” gives you a tour of the new development environment and points out some of its useful features.

In Chapter 5, “Visual Basic Building Blocks,” you learn the fundamentals about the Visual Basic language and how you use that language to write programs.

Each of these chapters in the first part of the book is designed to quickly make you comfortable with creating applications in the Visual Studio .NET development environment.

Visual Basic Programming Fundamentals

The second section of the book explores the Visual Basic language in more detail. This section is designed to explain language concepts that are critical to creating Visual Basic applications.

In Chapter 6, “Storing Information in Variables,” you are led into the world of variables and data types. You learn how to create and use variables, and how to perform math and string operations.

Chapter 7, “Controlling the Flow of Your Program,” discusses loops and decision structures. In this chapter you will learn how to control what your program does, based on the input given to it.

Chapter 8, “Managing Program Tasks with Procedures,” takes a look at how to create custom program functions and subroutines. By learning about these concepts, you can become a more efficient programmer.

Object-oriented programming is covered in Chapter 9, “Creating Code Components.” Not only does this chapter take a look at how to create and use custom classes, but we also describe how to access these classes as part of a multi-tier Web application.

Building Windows Applications

Part III, “Building Windows Applications,” expands the fundamental knowledge that you have gained so far by exploring various types of components you can use in Windows-based applications.

Chapter 10, “Understanding Windows Forms,” introduces you to the techniques used when designing and interacting with a Windows form.

Chapters 11 and 12 provide a useful reference to some of the built-in components Visual Basic provides for you to use when you build your programs. These components, or controls, can be used for a variety of application tasks, such as displaying text or initiating actions within a program. Chapter 11, “Fundamental Controls,” explores some of the more commonly used controls, while Chapter 12, “Advanced Controls,” discusses some additional, more specialized controls.

Chapter 13, “Using Dialog Boxes,” takes an in-depth look at a familiar user-interface component, the dialog box.

In Chapter 14, “Designing an Effective User Interface,” you learn about some user interface design principles that can make your application more appealing to the end user. In addition, we introduce you to adding graphics and pictures to your programs.

Chapter 15, “Multiple Document Interface (MDI) Applications” explores a special type of user interface in more detail. As you will learn, an MDI application provides a framework by which you can easily organize multiple forms in a visually pleasing manner.

You learned a lot about the built-in Windows controls in Chapters 11 and 12. Chapter 16, “Creating Your Own Windows Controls,” walks you through the process of creating, and then enhancing, your own Windows controls.

Working with the Web

The fourth section in the book is devoted to building Internet applications.

Chapter 17, “Using Active Server Pages.NET,” takes a tour of creating dynamic Web content through the use of Visual Basic code.

Chapter 18, “Web Applications and Services,” shows you how to program within the Webforms model, using Visual Studio to create versatile Web-based programs.

Chapter 19, “Web Controls,” introduces you to some of the built-in components that you can use in a .NET Web application.

Visual Basic and Databases

Database programs make up a large percentage of all programs in use in the business world today. These programs range in complexity from simple programs for managing mailing lists to complex programs handling reservations and billing for major corporations. Part V, “Visual Basic and Databases” takes you through the process of building database applications to meet a variety of needs.

Chapter 20, “Database Basics,” discusses the Structured Query Language (SQL) and shows you how to use SQL to create and manipulate data.

Chapter 21, “ActiveX Data Objects (ADO),” shows you how to use the ADO programming model to access your data from within Visual Basic code.

In Chapter 22, “Using ADO.NET (ADO),” we discuss Microsoft’s latest model for working with databases, ADO.NET. ADO.NET, which is part of the .NET framework, brings some new structures and concepts to the Visual Basic world.

Finally, Chapter 23, “Creating and Using Reports,” shows you how to output data from your database applications to a printed report using Crystal Reports and other techniques.

Advanced Programming Topics

In Part VI, “Advanced Programming Topics,” you are exposed to some additional material that is useful for any application developer.

Chapter 24, “Working with Files,” discusses how your programs can use different types of files for information storage and retrieval purposes.

Chapter 25, “Interacting with Other Applications,” shows you how to have your programs interact with other Windows applications, such as your word processor or e-mail system. In doing so, you can add features of these applications to your own program.

In Chapter 26, “Debugging and Performance Tuning,” you learn how to make your programs faster and more efficient, as well as how to identify and report errors.

Chapter 27, “Writing a Pocket PC Application,” takes a look at an exciting emerging technology and describes how you can use a Pocket PC application to capture data.

Additional References

You can use the Appendices as a guide to some of the things you’ll need to know as you develop your Visual Basic .NET applications.

Appendix A, “Packaging Your Applications,” shows you how to prepare the Visual Basic programs that you write for distribution.

Appendix B, “Tips on Conversion from VB6,” is for users of previous versions of Visual Basic. We discuss some ways to get the most out of VB .NET when converting an existing application.

Source Code and Programs Used in This Book

All the source code from the listings and programs included in this book is available via download from the Que—Macmillan Computer Publishing Web site. You can download the listings code to save typing time and errors as you follow examples in the book. You also can obtain all the programs built in the book and additional sample programs we’ve included.

To access this material, follow these steps:

1.
Point your browser to the following URL:

www.quepublishing.com

2.
Enter the book’s ISBN as directed:

0-7897-2572-X

3.
Follow the instructions to access and download the specific code or program you are looking for.

Conventions and Special Elements Used in This Book

This book includes various conventions and special elements to highlight specific things and make using the book easier. Familiarize yourself with these conventions and elements, and allow them to enhance your reading experience.

Conventions

The following list details conventions used in the book:

  • Italic type is used to emphasize the author’s points or to introduce new terms. You may also see italics used in code samples to indicate a placeholder for additional code.

  • Screen messages, code listings, and command samples appear in monospace type.

  • URLs, newsgroups, Internet addresses, and anything you are asked to type also appears in monospace type.

  • Occasionally, a code sample or listing will show a portion of program code with certain lines set in bold type. In such cases, the bold type signifies code you are to add to existing code. This approach enables you to see what you are supposed to add or change in context.

  • Because of the space limitations of this book’s pages, a few code lines in this book’s examples cannot be printed exactly as you must enter them. In cases where breaking such a line is necessary to fit within the book’s margins, the Visual Basic continuation character (_) will be used at the end of the line that is broken. You can leave these characters out and enter the code on a single line, or just enter the characters as they appear. Visual Basic will understand the code either way. If you download the code from the Web site, you will not have to worry about adding this character.

Special Elements

Certain types of information are set off in special book elements. The following explanations and examples indicate the kinds of elements you will encounter in the book.

At the end of each chapter you may find a “From Here . . . ” section, a Q&A, or a Troubleshooting section to wrap up the chapter. These sections refer you to other chapters that cover related material or extend the topic you just read about. They are designed to help you synthesize the information or troubleshoot problems.

→ See cross-references within each chapter for directions to more information on a particular topic.

Tip

Tips present short advice on a quick or often overlooked procedure.


Note

Notes provide additional information that might help you avoid problems, or offer advice that relates to the topic.


Caution

Cautions warn you about potential problems that a procedure might cause, unexpected results, and mistakes to avoid.


Sidebar

Longer discussions not integral to the flow of the chapter are set aside as sidebars. Look for these sidebars to find out even more information.


System Suggestions for Visual Basic .NET

As with most types of software, a more powerful computer will make Visual Studio .NET perform faster. Usually the “minimum system requirements” printed on the box are just that, bare minimum requirements that may not always be useful in the real world. In writing this book, we found that while Visual Studio .NET worked acceptably on a variety of computers, you will more likely enjoy the experience if you use a fast computer with plenty of memory. The author’s test computers generally met or exceeded the following specifications:

  • 733 megahertz Pentium III class processor

  • 512 megabytes of RAM.

  • A large hard drive with several gigabytes of free disk space

  • A fast hard drive (for example, ultra-DMA)

  • A fast video card.

  • An Internet connection

These are, of course, personal recommendations based on my own experience and should be taken with a grain of salt. Even if your computer falls below these baseline requirements, you may still be able to use it. For example, although VB .NET ran noticeably slower on a Pentium II-450 megahertz computer with 256 megabytes of RAM, it was still very usable. In general, increasing a computer’s RAM memory seemed to make the most difference in overall performance.

We also found that for developing Web applications (which include communication between two computers) a home network was very handy. Networked PCs allow you test distributed applications in a realistic setting, by splitting parts of your program across multiple computers. In addition, if you have an “always on” Internet connection such as a cable modem or DSL service, I suggest purchasing a network router. This inexpensive device allows you to share your Internet connection with all PCs on your home network.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.125.2