Preface

In July 2000, Microsoft announced the release of its new .NET platform, which represented a major change in the way people think about programming. .NET facilitates object-oriented Internet development. Visual Basic .NET (VB.NET) is a programming language that was adapted from its predecessor, Visual Basic 6, specifically for the purpose of writing applications for the .NET platform. This new version of the Visual Basic language is well suited for developing distributed web applications.

About This Book

Learning Visual Basic .NET is a primer on the VB.NET language, in the context of the .NET development environment, and also on object-oriented programming. This book focuses on the fundamentals of the VB.NET programming language, both syntactical and semantic. After mastering these concepts, you should be ready to move on to a more advanced programming guide that will help you create large-scale web and Windows applications. Chapter 19 provides a number of suggestions for your continued study of VB.NET and .NET development.

Who This Book Is For

Learning Visual Basic .NET was written for programmers with little or no object-oriented programming experience, as well as for novice programmers. Those coming from another language may have a slight advantage, but I’ve tried to provide an on-ramp for beginners as well, by defining all terms, demonstrating the relationships among the various constructs, and reviewing key concepts along the way.

How the Book Is Organized

Chapter 1 introduces you to the VB.NET language and the .NET platform.

Chapter 2 presents a simple application that prints the words “Hello World” to a console window and gives a line-by-line analysis of the code.

Chapter 3 explains the principles behind and goals of this programming methodology, including the three pillars of object-oriented programming: encapsulation, specialization, and polymorphism.

Chapter 4 introduces the Integrated Development Environment (IDE) designed specifically for .NET; using the IDE can greatly simplify how you write applications.

Chapter 5 introduces the basic syntax and structure of the VB.NET language, including the intrinsic types, variables, statements, and expressions.

Chapter 6 describes some of the ways you can change the order in which methods are called within a program. Statements such as If, ElseIf, and Select Case will be considered, along with the concept of loops, which are created using such keywords as Do, Do While, and Loop While.

Chapter 7 describes some of the symbols that cause VB.NET to take an action, such as assigning a value to a variable and arithmetically operating on values (adding, subtracting, etc.).

Chapter 8 introduces the key concepts of programmer-defined types (classes) and instances of those types (objects). Classes and objects are the building blocks of object-oriented programming.

Chapter 9 delves into the specific programming instructions you’ll write to define the behavior of objects.

Chapter 10 introduces the debugger integrated into the Visual Studio .NET Integrated Development Environment.

Chapter 11 explores two of the key concepts behind object-oriented programming and demonstrates how you might implement them in your code.

Chapter 12 introduces the structure or struct, a programmer-defined type similar to a class, but with specific and more limited functionality.

Chapter 13 explains how you can define a set of behaviors (an interface) that any number of classes might implement.

Chapter 14 introduces the array, an indexed collection of objects, all of the same type. Arrays are one of the collection types recognized by VB.NET.

Chapter 15 describes some of the other VB.NET collections, including stacks and queues.

Chapter 16 discusses the manipulation of strings of characters, the VB.NET String class, and regular expression syntax.

Chapter 17 explains how to handle errors and abnormal conditions that may arise in relation to your programs.

Chapter 18 discusses how to write code to respond to programming occurrences like mouse clicks, keystrokes, and other events. The chapter also introduces some of the basic concepts of application programming.

Building serious commercial applications is beyond the scope of a primer like Learning Visual Basic .NET. But Chapter 19 describes where you might go to learn more about VB.NET and .NET programming, including other books, web sites, newsgroups, and so forth.

Conventions Used in This Book

The following font conventions are used in this book:

Italic

Used for pathnames, filenames, program names, Internet addresses, such as domain names and URLs, and new terms where they are defined.

Constant Width

Used for command lines and options that should be typed verbatim, VB.NET keywords, and code examples.

Constant Width Italic

Used for replaceable items, such as variables or optional elements, within syntax lines or code.

Constant Width Bold

Used for emphasis within program code.

Pay special attention to notes set apart from the text with the following icons:

Tip

This is a tip. It contains useful supplementary information about the topic at hand.

Warning

This is a warning. It helps you solve and avoid annoying problems.

Support

As part of my responsibilities as author, I provide ongoing support for my books through my web site.

http://www.LibertyAssociates.com

On this web site, you’ll also find the complete source code for all the examples in Learning Visual Basic .NET, as well as access to a book-support discussion group with a section set aside for questions about VB.NET. Before you post a question, however, please check the FAQ (Frequently Asked Questions) list and the errata file on my web site. If you check these files and still have a question, then please go ahead and post to the discussion center.

The most effective way to get help is to ask a precise question or even to create a small program that illustrates your area of concern or confusion. You may also want to check the various newsgroups and discussion centers on the Internet. Microsoft offers a wide array of newsgroups, and Developmentor (http://www.develop.com) has wonderful .NET email discussion lists as does Charles Carroll at http://www.asplists.com.

We’d Like to Hear from You

We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). Please let us know about any errors you find, as well as your suggestions for future editions, by writing to:

O’Reilly & Associates, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international/local)
(707) 829-0104 (fax)

We have a web page for this book where we list examples and any plans for future editions. You can access this information at:

http://www.oreilly.com/catalog/learnvbnet

You can also send messages electronically. To be put on the mailing list or request a catalog, send email to:

To comment on the book, send email to:

For more information about this book and others, as well as additional technical articles and discussion on the VB.NET and the .NET Framework, see the O’Reilly & Associates web site:

http://www.oreilly.com

and the O’Reilly .NET DevCenter:

http://www.oreillynet.com/dotnet

http://www.ondotnet.com/dotnet/ provides independent coverage of fundamental, interoperable, and emerging Microsoft .NET programming and web services technologies.

Acknowledgments

To ensure that Learning Visual Basic .NET is accurate, complete, and targeted at the needs and interests of programmers, I enlisted the help of some of the brightest people I know, including Dan Hurwitz, Seth Weiss, and Sue Lynch.

John Osborn signed me to O’Reilly, for which I will forever be in his debt. Darren Kelly, Claire Cloutier, and Tatiana Diaz helped make this book better than what I’d written. Rob Romano created a number of the illustrations and improved the others. Tim O’Reilly provided support and resources, and I’m grateful. A special thank you to Val Quercia, who added great value to this book, as she has to so many others. If this book is clear and understandable, it is due to her vigilance.

Get Learning Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.