Home > Store

Visual Basic.NET How to Program, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Visual Basic.NET How to Program, 2nd Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale



  • NEW - Thoroughly re-written to reflect the new features and functionality of Visual Basic .NET.
    • Provides readers with up-to-date coverage of topics such as multi-tier Web-based application development using Web forms and Web services, data manipulation using the Extensible Markup Language (XML), object-oriented programming including implementation inheritance, multithreading, exception handling, database manipulation using ADO+, graphics programming with GDI+ and accessibility.

  • NEW - Now in full color—Program listings now include syntax coloring of code.
    • Helps readers better interpret the code.

  • Signature “Live Code™ Approach”—Language features are presented in the context of a wide variety of complete working programs. Features thousands of lines of code in hundreds of complete working programs.
    • Enables students to confirm that programs run as expected. Students can also manipulate the code from the CD-ROM in the back of the book or from the book's Companion Website (www.prenhall.com/deitel) or from the author's website (www.deitel.com).

  • Outstanding, consistent and applied pedagogy—Icons throughout identify Software Engineering Observations; Good Programming Practices; Common Programming Errors; Portability Tips; Performance Tips, Testing and Debugging Tips, and Look-and-Feel Observations.
    • Provides hundreds of valuable programming tips and facilitates learning.

  • Extensive set of interesting exercises and substantial projects.
    • Students can apply what they've learned in each chapter.

  • Also available with the Multimedia Cyber Classroom —In The Complete Visual Basic .NET Training Course, Second Edition, Student Edition (CD-ROM version: 0-13-042541-9; Web-based version: 0-13-067371-4).
    • Provides extra hands-on experience and study aids for a minimal additional cost. Includes many hours of detailed, expert audio walkthroughs of the book's hundreds of live-code examples; post-assessment exams with hundreds of short answer questions (all with answers); hundreds of self-review exercises drawn from the text (half with answers); hundreds of programming exercises from the main text (these exercises don't have answers in the main text, but half of these exercises have answers in The Complete Training Course); hundreds of tips that are marked with icons and show how to write Visual Basic code that's portable, reusable, and optimized for performance; and full-text searching and hyperlinking.

Each How to Program text can be ordered as a Complete Training Coursepackage, containing the main text and the corresponding Cyber Classroom—an interactive, multimedia, tutorial version of the book. The Complete Training Coursesare a great value, giving students additional hands-on experience and study aids for a minimal additional cost.

Each Complete Training Course is compatible with Windows 95, Windows 98, Windows NT and Windows 2000 and includes the following features:

  • The full text, illustrations and program listings of its corresponding How to Program book with full-text searching and hyperlinking.
  • Hours of detailed, expert audio descriptions of thousands of lines of code that help to reinforce concepts.
  • An abundance of self-assessment material:
    • Practice exams that offer students hundreds of short answer test questions and answers.

    • Hundreds of self-review questions that are drawn from the text, all with answers.

    • Hundreds of programming exercises that are drawn from the text, half with answers (the main text does not provide any answers to these exercises).

  • Intuitive browser-based interface, designed to be easy and accessible for anyone who's ever used a Web browser.

We offer the Complete Training Courses in either CD-ROM or Web-based format. When professors order the Web-based version of a Complete Training Course, their students receive the corresponding How to Programbook packaged with a URL and password that gives then six months of access to the Cyber Classroom software via the Web.

If your customer has already received Visual Basic .NET How to Program, Second Edition, please sample only the Visual Basic .NET Multimedia Cyber Classroom CD-ROM to show them the advantages they would get with The Complete Training Course.Please do not sample The Complete Training Courseas they will receive a duplicate copy of the main text.


  • Copyright 2002
  • Edition: 2nd
  • Premium Website
  • ISBN-10: 0-13-029363-6
  • ISBN-13: 978-0-13-029363-3

The authoritative DEITEL LIVE-CODE introduction to Windows®, .NET, Internet and World Wide Web programming in Visual Basic® .NET

This exciting new Second Edition of the Deitels' best-selling Visual Basic textbook carefully explains how to use Visual Basic .NET—a premier language in Microsoft's new .NET initiative—as a general-purpose programming language and how to program multi-tier, client/server, database-intensive, Internet- and Web-based .NET applications.

Dr. Harvey M. Deitel and Paul J. Deitel are the founders of Deitel & Associates, Inc., the internationally-recognized corporate-training and content-creation organization specializing in Visual Basic® .NET, C#, Visual C++® .NET, Java, C++, C, XML, Python, Perl; Internet, Web, wireless, e-business and object technologies. The Deitels are the authors of several worldwide #1 programming-language textbooks, including Java How to Program, 4/e, C++ How to Program, 3/e and Internet & World Wide Web How to Program, 2/e.

In Visual Basic .NET How to Program, 2/e, the Deitels and their colleague, Tem. R. Nieto, discuss topics you need to build complete .NET, Web-based applications, including:

  • .NET Introduction/IDE/Debugger
  • Control Structures/Procedures/Arrays
  • Classes/Data Abstraction/Strings
  • OOP/Inheritance/Polymorphism
  • Methods/Properties/Events/Delegates
  • Data Structures/Collections/Unicode®
  • Database/ADO.NET/SQL
  • Assemblies/Modules/Exceptions
  • GUI/Forms/Controls/Visual Inheritance
  • Web Services/ASP.NET/Web Forms
  • VoiceXML/Regular Expressions
  • Files/Streams/Multimedia/Graphics/GDI+
  • Multithreading/Client-Server/Networking
  • Session Tracking/Cookies/Accessibility
  • HTML 4/XHTML/COM Integration

Visual Basic .NET How to Program, 2/e includes extensive pedagogic features:

  • Hundreds of LIVE-CODE programs with screen captures that show exact outputs
  • Extensive World Wide Web and Internet resources to encourage further research
  • Hundreds of tips, recommended practices and cautions—all marked with icons

Visual Basic .NET How to Program, 2/e is the centerpiece of a complete family of resources for teaching and learning Visual Basic .NET, including several Web sites (www.deitel.com and www.prenhall.com/deitel) with the book's source-code examples (which are also on the enclosed CD) and other information for faculty, students and professionals; an optional interactive CD (Visual Basic .NET Multimedia Cyber Classroom, 2/e) containing hyperlinks, solutions to half the book's exercises and audio walkthroughs of the book's code examples; and e-mail access to the authors at:

For information on worldwide Deitel on-site seminars and to subscribe to the Deitel Buzz e-mail newsletter, visit:

Sample Content

Table of Contents

(NOTE: Each chapter begins with an Introduction.)

1. Introduction to Computers, Internet, World Wide Web and Visual Basic .NET.

What Is a Computer? Computer Organization. Evolution of Operating Systems. Personal Computing. Distributed Computing and Client/Server Computing. Machine Languages, Assembly Languages and High-Level Languages. Visual Basic .NET. C, C++, Java™ and C#. Other High-Level Languages. Structured Programming. Key Software Trend: Object Technology. Hardware Trends. History of the Internet and World Wide Web. World Wide Web Consortium (W3C). Extensible Markup Language (XML). Introduction to Microsoft .NET. .NET Framework and the Common Language Runtime. Tour of the Book. Internet and World Wide Web Resources.

2. Introduction to the Visual Studio .NET IDE.

Overview of the Visual Studio .NET IDE. Menu Bar and Toolbar. Visual Studio .NET IDE Windows. Using Help. Simple Program: Displaying Text and an Image. Internet and World Wide Web Resources.

3. Introduction to VB Programming.

Simple Program: Printing a Line of Text. Another Simple Program: Adding Integers. Memory Concepts Arithmetic. Decision Making Equality and Relational Operators. Using a Dialog to Display a Message. Internet and World Wide Web Resources.

4. Control Structures: Part 1.

Algorithms. Pseudocode. Control Structures. If/Then Selection Structure. If/Then/Else Section Structures. While Repetition Structure. Do While/Loop Repetition Structure. Do/Loop Repetition Structure. Assignment Operators. Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition). Formulating Algorithms with Top-Town, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition). Formulating Algorithms with Town-Down, Stepwise Refinement: Case Study 3 (Nested Control Structures). Formulating Algorithms with Town-Down, Stepwise Refinement: Case Study 4 (Nested Repetition Structures). Introduction to Widows Application Programming.

5. Control Structures: Part 2.

Essentials of Counter-Controlled Repetition. For/Next Repetition Structure. Examples Using the For/Next Structure. Selecting Case Multiple- Selection Structure. Do/Loop While Repetition Structure. Do/Loop Until Repetition Structure. Logical Operators. Structured Programming Summary.

6. Procedures.

Modules, Classes and Procedures. Sub Procedures. Function Procedures. Methods. Argument Promotion. Option Strict and Data-Type Conversions. Value Types and Reference Types. Passing Arguments: Pass-by-Value vs. Pass-by-Reference. Duration of Identifiers. Scope Rules. Random-Number Generation. Example: Game of Chance. Recursion. Example Using Recursion: Fibonacci Series. Recursion vs. Iteration. Procedure Overloading and Optional Arguments. Modules.

7. Arrays.

Arrays. Declaring and Allocating Arrays. Examples Using Arrays. Passing Arrays to Procedures. Passing Arrays: ByVal vs. ByRef. Sorting Arrays. Searching Arrays: Linear Search and Binary Search. Multidimensional Rectangular and Jagged Arrays. Variable-Length Parameter Lists. For Each/Next Repetition Structure.

8. Object-Based Programming.

Implementing a Time Abstract Data Type with Class. Class Scope. Controlling Access to Members. Initializing Class Objects: Constructors. Using Overloaded Constructors. Properties. Composition: Objects as Instance Variables of Other Classes. Using the Me Reference. Garbage Collection. Shared Class Members. Const and ReadOnly Members. Data Abstraction and Information Hiding. Software Reusability Namespaces and Assemblies. Class View and Object Browser.

9. Object-Oriented Programming: Inheritance.

Base Classes and Derived Classes. Protected and Friend Members. Relationship between Base Classes and Derived Classes. Case Study: Three-Level Inheritance Hierarchy. Constructors and Finalizers in Derived Classes. Software Engineering with Inheritance.

10. Object-Oriented Programming: Polymorphism.

Derived-Class-Object to Base-Class-Object Conversion. Type Fields and Select Case Statements. Polymorphism Examples. Abstract Classes and Methods. Case Study: Inheriting Interface and Implementation. Mon Inheritable Classes and NotOverridable Methods. Case Study: Payroll System Using Polymorphism. Case Study: Creating and Using Interfaces. Delegates.

11. Exception Handling.

Exception Handling Overview. Example: DivideByZeroException. Net Exception Hierarchy. Final Block. Exception Properties. Programmer-Defined Exception Classes. Handling Overflows.

12. Graphical User Interface Concepts: Part 1.

Windows Forms. Event-Handling Model. Control Properties and Layout. Labels, Textboxes, and Buttons. PictureBoxes. Mouse-Event Handling. Keyboard-Event Handling.

13. Graphical User Interface Concepts: Part 2.

Menus. LinkLabels. ListBoxes, and CheckedListBoxes. ComboBoxes. TreeViews. ListViews. Tab Control. Multiple-Document-Interface (MDI) Windows. Visual Inheritance. User-Defined Controls.

14. Multithreading.

Thread States: Life Cycle of a thread. Thread Priorities and Thread Scheduling. Thread Synchronization and Class Monitor. Producer/Consumer Relationship without Thread Synchronization. Producer/Consumer Relationship with Thread Synchronization. Producer Consumer Relationship: Circular Buffer.

15. Strings, Characters and Regular Expressions.

fundamentals of Characters and Strings. Strings Constructors. String Length and Chars Properties, and CopyTo Method. Comparing Strings. String Method GetHashCode. Locating Characters and Substrings in Strings. extracting Substrings from Strings. Concatenating Strings. Miscellaneous String Methods. Class StringBuilder. StringBuilder Indexer, Length and Capacity Properties, and EnsureCapacity Methods. StringBuilder Insert, Remove and Replace Methods.

16. Graphics and Multimedia.

Graphics Contexts and Graphics Objects. Color Control. Front Control. Drawing Lines, Rectangles and Ovals. Drawing Arcs. Drawing Polygons and Polylines. Advanced Graphics Capabilities. Introduction to Multimedia. Loading, Displaying and Scaling Images. Animating a Series of Images. Windows Media Player. Microsoft Agent.

17. Files and Streams.

data Hierarchy. Files and Streams. Classes Files and Directory. Creating a Sequential-Access File. Reading Data from a Sequential-Access File. Random-Access File. Writing Data Randomly to a Random-Access File. Case Study: A Transaction-Processing Program.

18. Extensible Markup Language (XML).

XML Documents. XML Namespaces. Document Object Model (DOM). Document type Definitions (DTDs) Schemes and Validation. Extensible Stylesheet Language and XlsTransform. Microsoft BizTalk™. Internet and World Wide Web Resources.

19. Database, SQL and ADO .NET.

Relational Database Model. Relational Database Overview: Books Database. ADO .NET Object Model. Programming with ADO .NET: Extracting Information from a DBMS. Programming with ADO .NET: Modifying a DBMS. Reading and Writing XML Files.

20. ASP .NET, Web Forms and Web Controls.

Simple HTTP Transaction. System Architecture. Creating and Running a Simple Web-Form Example. Web Controls. Session Tracking. Case Study: Online Guest book. Case Study: Connecting to a Database in ASP .NET. Tracing Internet and World Wide Web Resources.

Simple HTP Transaction. System Architecture. Creating and Running a Simple Web-Form Example. Session Tracking. Case Study: Online Guest book. Case Study: Connecting to a Database in ASP .NET. Tracing Internet and World Wide Web Resources.

21. ASP .NET and Web Services.

Web Services. Simple Object Access Protocol (SOAP) and Web Services. Publishing and Consuming Web Services. Session Tracking in Web Services. Using Web Forms and Web Services. Case Study: Temperature Information Application. User-Defined Types in Web Services. Internet and World Wide Web Resources.

22. Networking: Streams-Based Sockets and Datagrams.

Establishing a Simple Server (Using Stream Sockets). Establishing a Simple Client (Using Stream Sockets). Client/Serve Interaction via Stream-Socket Connections. Connectionless Client/Server Interaction via Datagrams. Client/Serve Tic-Tac-Toe Using a Multithreaded Server.

23. Data Structures and Collections.

Self-Referential Classes. Linked Lists. Stacks. Queues. Collection Classes. Linked Lists. Stacks. Queues. Trees. Collection Classes.

24. Accessibility.

Regulations and Resources. Web Accessibility Initiative. Providing Alternatives for Images. Maximizing Readability by Focusing on Structure. Accessibility in Visual Studio .NET. Accessibility in Visual Basic. Accessibility in XHTML Tables. Accessibility in XHTML Frames. Accessibility in XML. Using Voice Synthesis and Recognition with VoiceXML™. CallXML™. JAWS® for Windows. Other

A. Operator Precedence Charts.

B. Number Systems on (CD).

abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers. Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers. Converting from Binary, Octal or Hexadecimal to Decimal. Converting from Decimal to Binary, Octal or Hexadecimal. Negative Binary umbers: Two's Complement Notation.

C. Career Opportunities (on CD).

Resources for the Job Seeker. Online Opportunities for Employers. Recruiting Services. Internet and World Wide Web Resources.

D. Visual Studio .NET Debugger.

Breakpoints. Examining Data. Program Control. Additional Procedure Debugging Capabilities. Additional Class Debugging Capabilities.

Appendix E. ASCII Character Set.

Appendix F. Unicode® (on CD)

Unicode Transformation Formats. Characters and Glyphs. Advantages/Disadvantages of Unicode. Unicode Consortium's Web Site. Using Unicode. Character Ranges.

Appendix G. COM Integration (on CD).

ActiveX Integration. DLL Integration. Internet and World Wide Web Resources. CHAPTER = Appendix H. Introduction to HyperText Markup Language 4: Part 1 (on CD).

Markup Languages. Editing HTML. Common Elements. Headers. Linking. Images. Special Characters and More Line Breaks. Unordered Lists. Nested and Ordered Lists. Internet and World Wide Web Resources.

I. Introduction to HyperText Markup Language 4: Part 2 (on CD).

Basic HTML Tables. Intermediate HTML Tables and Formatting. Basic HTML Tables. Basic HTML Forms. More Complex HTML Forms. Internal Linking. Creating and Using Image Maps. meta Tags. frameset Element. Nested framesets. Internet and World Wide Web Resources.

J. Introduction to XHTML: Part I (on CD).

editing XHTML. First XHTML Example W3C XHTML Validation Service. Headers. Linking. Images. Special Characters and More Line Breaks. Unordered Lists. Nested and Ordered Lists. Internet and World Wide Web Resources.

L. HTML/XHTML Special Characters.


N. Crystal Reports® for Visual Studio .NET.

Crystal Reports Web Site Resources. Crystal Reports and Visual Studio .NET.




Live in fragments no longer. Only connect.
Edward Morgan Forster

We wove a web in childhood,
A web of sunny air.

Charlotte Brontë

Welcome to Visual Basic .NET and the exciting world of Windows, Internet and World-Wide-Web programming with Visual Studio and the .NET platform! This book is the first in our new .NET How to Program series, which presents various leading-edge computing technologies in the context of the .NET platform.

Visual Basic .NET provides the features that are most important to programmers, such as object-oriented programming, strings, graphics, graphical-user-interface (GUI) components, exception handling, multithreading, multimedia (audio, images, animation and video), file processing, prepackaged data structures, database processing, Internet and World-Wide-Web-based client/server networking and distributed computing. The language is appropriate for implementing Internet-based and World-Wide-Web-based applications that seamlessly integrate with PC-based applications. Visual Basic .NET is the next phase in the evolution of Visual Basic, the world's most popular programming language.

The .NET platform offers powerful capabilities for software development and deployment, including independence from a specific language or platform. Rather than requiring developers to learn a new programming language, programmers can contribute to the same software project, but write code using any (or several) of the .NET languages (such as Visual Basic .NET, Visual C++ .NET, C# and others) with which they are most competent. In addition to providing language independence, .NET extends program portability by enabling .NET applications to reside on, and communicate across, multiple platforms—thus facilitating the delivery of Web services over the Internet. .NET enables Web-based applications to be distributed to consumer-electronic devices, such as cell phones and personal digital assistants, as well as to desktop computers. The capabilities that Microsoft has incorporated into the .NET platform create a new software-development paradigm that will increase programmer productivity and decrease development time.

New Features in Visual Basic.NET How to Program: Second Edition

This edition contains many new features and enhancements, including:

  • Full-Color Presentation. This book is now in full color. In the book's previous edition, the programs were displayed in black and the screen captures appeared in a second color. Full color enables readers to see sample outputs as they would appear on a color monitor. Also, we now syntax color the Visual Basic .NET code, similar to the way Visual Studio .NET colors the code in its editor window. Our syntax-coloring conventions are as follows:
    - comments appear in green
    - keywords appear in dark blue
    - literal values appear in light blue
    - text, class, method and variable names appear in black
    - errors and ASP delimiters appear in red
  • "Code Washing." This is our term for the process we use to format the programs in the book so that they have a carefully commented, open layout. The code appears in full color and grouped into small, well-documented pieces. This greatly improves code readability—an especially important goal for us, considering that this book contains about 21,000 lines of code.
  • Web Services and ASP.NET. Microsoft's .NET strategy embraces the Internet and Web as integral to the software development and deployment processes. Web services, a key technology in this strategy, enables information sharing, commerce and other interactions using standard Internet protocols and technologies, such as Hypertext Transfer Protocol (HTTP), Simple Object Access Protocol (SOAP) and Extensible Markup Language (XML). Web services enable programmers to package application functionality in a form that turns the Web into a library of reusable software components. In Chapter 21, ASP .NET and Web Services, we present a Web service that allows users to make airline seat reservations. In this example, a user accesses a Web page, chooses a seating option and submits the page to the Web server. The page then calls a Web service that checks seat availability. We also present information relating to Web services in Appendix N, Crystal Reports for Visual Studio .NET, which discusses popular reporting software for database-intensive Visual Basic .NET applications. Crystal Reports, which is integrated into Visual Studio .NET, provides the ability to expose a report as a Web service. The appendix provides introductory information and then directs readers to a walkthrough of this process on the Crystal Decisions Web site (www.crystaldecisions.com/net).
  • Web Forms, Web Controls and ASP.NET. Applications developers must be able to create robust, scalable Web-based applications. The .NET platform architecture supports such applications. Microsoft's .NET server-side technology, Active Server Pages (ASP) .NET, allows programmers to build Web documents that respond to client requests. To enable interactive Web pages, server-side programs process information users input into HTML forms. ASP .NET is a significant departure from previous versions of ASP, allowing developers to program Web-based applications using the powerful object-oriented languages of .NET. ASP .NET also provides enhanced visual programming capabilities, similar to those used in building Windows forms for desktop programs. Programmers can create Web pages visually, by dragging and dropping Web controls onto a Web form. Chapter 20, ASP .NET, Web Forms and Web Controls, introduces these powerful technologies.
  • Object-Oriented Programming. Object-oriented programming is the most widely employed technique for developing robust, reusable software, and Visual Basic .NET offers enhanced object-oriented programming features. This text offers a rich presentation of object-oriented programming. Chapter 8, Object-Based Programming, introduces how to create classes and objects. These concepts are extended in Chapter 9, Object-Oriented Programming: Inheritance—which discusses how programmers can create new classes that "absorb" the capabilities of existing classes. Chapter 10, Object-Oriented Programming: Polymorphism—familiarizes the reader with the crucial concepts of polymorphism, abstract classes, concrete classes and interfaces, which facilitate powerful manipulations among objects belonging to an inheritance hierarchy.
  • XML. Use of Extensible Markup Language (XML) is exploding in the software-development industry, the e-business and e-commerce communities, and is pervasive throughout the.NET platform. Because XML is a platform-independent technology for describing data and for creating markup languages, XML's data portability integrates well with Visual Basic .NET's portable applications and services. Chapter 18, Extensible Markup Language (XML) introduces XML. In this chapter, we introduce basic XML markup and discuss the technologies such as DTDs and Schema, which are used to validate XML documents' contents. We also explain how to programmatically manipulate XML documents using the Document Object Model (DOM) and how to transform XML documents into other types of documents via Extensible Stylesheet Language Transformations (XSLT).
  • Multithreading. Computers enable us to perform many tasks in parallel (or concurrently), such as printing documents, downloading files from a network and surfing the Web. Multithreading is the technology through which programmers can develop applications that perform concurrent tasks. Historically, a computer has contained a single, expensive processor, which its operating system would share among all applications. Today, processors are becoming so inexpensive that it is possible to build affordable computers containing many processors that work in parallel—such computers are called multiprocessors. Multithreading is effective on both single-processor and multiprocessor systems. Visual Basic .NET's multithreading capabilities make the platform and its related technologies better prepared to deal with today's sophisticated multimedia-intensive, database-intensive, network-based, multiprocessor-based, distributed applications. Chapter 14, Multithreading provides a detailed discussion of multithreading.
  • Visual Studio .NET Debugger. Debuggers are programs that help programmers find and correct logic errors in program code. Visual Studio .NET contains a powerful debugging tool that allows programmers to analyze their program line-byline as the program executes. In Appendix D, Visual Studio .NET Debugger, we explain how to use key debugger features, such as setting breakpoints and "watches," stepping into and out of procedures, and examining the procedure call stack.
  • Appendix C, Career Opportunities. This appendix introduces career services available on the Internet. We explore online career services from both the employer's and employee's perspectives. We list many Web sites at which you can submit applications, search for jobs and review applicants (if you are interested in hiring someone). We also review services that build recruiting pages directly into e-businesses. One of our reviewers told us that he had used the Internet as a primary tool in a recent job search, and that this appendix would have helped him expand his search dramatically.
  • Appendix F, Unicode. As computer systems evolved worldwide, computer vendors developed numeric representations of character sets and special symbols for the local languages spoken in different countries. In some cases, different representations were developed for the same languages. Such disparate character sets hindered communication among computer systems. Visual Basic .NET supports the Unicode Standard (maintained by a non-profit organization called the Unicode Consortium), which maintains a single character set that specifies unique numeric values for characters and special symbols in most of the world's languages. This appendix discusses the standard, overviews the Unicode Consortium Web site (www.unicode.org) and presents a Visual Basic .NET application that displays "Welcome to Unicode!" in several languages.
  • COM (Component Object Model) Integration. Prior to the introduction of .NET, many organizations spent tremendous amounts of time and money creating reusable software components called COM components, which include ActiveX® controls and ActiveX DLLs (dynamic link libraries) for Windows applications. Visual Basic programmers traditionally have been the largest group of COM component users. In the appendix, COM Integration, we discuss some of the tools available in Visual Studio .NET for integrating these legacy components into .NET applications. This integration allows programmers to use existing sets of COM-based controls with .NET components.
  • XHTML. The World Wide Web Consortium (W3C) has declared HTML to be a legacy technology that will undergo no further development. HTML is being replaced by the Extensible Hypertext Markup Language (XHTML)—an XML-based technology that is rapidly becoming the standard for describing Web content. We use XHTML in Chapter 18, Extensible Markup Language (XML), and offer an introduction to the technology in Appendix J, Introduction to XHTML: Part 1, and Appendix K, Introduction to XHTML: Part 2. These appendices overview headers, images, lists, image maps and other features of this emerging markup language. (We also present a treatment of HTML in Appendices H and I, because ASP .NET, used in Chapters 20 and 21, generates HTML content).
  • Accessibility. Currently, although the World Wide Web has become an important part of many people's lives, the medium presents many challenges to people with disabilities. Individuals with hearing and visual impairments, in particular, have difficulty accessing multimedia-rich Web sites. In an attempt to improve this situation, the World Wide Web Consortium (W3C) launched the Web Accessibility Initiative (WAI), which provides guidelines for making Web sites accessible to people with disabilities. Chapter 24, Accessibility, describes these guidelines and highlights various products and services designed to improve the Web-browsing experiences of individuals with disabilities. For example, the chapter introduces VoiceXML and CallXML, two XML-based technologies for increasing the accessibility of Web-based content for people with visual impairments.

Some Notes to Instructors

Students Enjoy Learning a Leading-Edge Language
Dr. Harvey M. Deitel taught introductory programming courses in universities for 20 years with an emphasis on developing clearly written, well-designed programs. Much of what is taught in these courses represents the basic principles of programming, concentrating on the effective use of data types, control structures, arrays and functions. Our experience has been that students handle the material. in this book in about the same way that they handle other introductory and intermediate programming courses. There is one noticeable difference, though: Students are highly motivated by the fact that they are learning a leading-edge language, Visual Basic .NET, and a leading-edge programming paradigm (object-oriented programming) that will be immediately useful to them as they enter a business world in which the Internet and the World Wide Web have a massive prominence. This increases their enthusiasm for the material—which is essential when you consider that there is much more to learn in a Visual Basic .NET course now that students must master both the base language and substantial class libraries as well. Although Visual Basic .NET is a significant departure from Visual Basic 6.0, forcing programmers to revamp their skills, programmers will be motivated to do so because of the powerful range of capabilities that Microsoft is offering in its .NET initiative.

A World of Object Orientation
When we wrote the first edition of Visual Basic 6 How to Program, universities were still emphasizing procedural programming. The leading-edge courses were using object-oriented C++, but these courses generally mixed a substantial amount of procedural programming with object-oriented programming—something that C++ lets programmers do. Many instructors now are emphasizing a pure object-oriented programming approach. This book—the second edition of Visual Basic .NET How to Program and the first text in our .NET series—takes a predominantly object-oriented approach because of the enhanced object orientation provided in Visual Basic .NET.

Focus of the Book
Our goal was clear: Produce a Visual Basic.NET textbook for introductory university-level courses in computer programming aimed at students with little or no programming experience, yet offer the depth and the rigorous treatment of theory and practice demanded by both professionals and students in traditional, upper-level programming courses. To meet these objectives, we produced a comprehensive book that patiently teaches the principles of computer programming and of the Visual Basic .NET language, including control structures, object-oriented programming, Visual Basic .NET class libraries, graphical-user-interface concepts, event-driven programming and more. After mastering the material in this book, students will be well-prepared to program in Visual Basic .NET and to employ the capabilities of the .NET platform.

Multimedia-Intensive Communications
People want to communicate. Sure, they have been communicating since the dawn of civilization, but the potential for information exchange has increased dramatically with the evolution of various technologies. Until recently, even computer communications were limited mostly to digits, alphabetic characters and special characters. The current wave of communication technology involves the distribution of multimedia—people enjoy using applications that transmit color pictures, animations, voices, audio clips and even full-motion color video over the Internet. At some point, we will insist on three-dimensional, moving-image transmission.

There have been predictions that the Internet will eventually replace radio and television as we know them today. Similarly, it is not hard to imagine newspapers, magazines and books delivered to "the palm of your hand" (or even to special eyeglasses) via wireless communications. Many newspapers and magazines already offer Web-based versions, and some of these services have spread to the wireless world. When cellular phones were first introduced, they were large and cumbersome. Today, they are small devices that fit in our pockets, and many are Internet-enabled. Given the current rate of advancement, wireless technology soon could offer enhanced streaming-video and graphics-packed services, such as video conference calls, and high-power, multi-player video games.

Teaching Approach
Visual Basic .NET How to Program, Second Edition contains a rich collection of examples, exercises and projects drawn from many fields and designed to provide students with a chance to solve interesting, real-world problems. The book concentrates on the principles of good software engineering, and stressing program clarity. We are educators who teach edge-of-the-practice topics in industry classrooms worldwide. We avoid arcane terminology and syntax specifications in favor of teaching by example. Our code examples have been tested on Windows 2000 and Windows XP. The text emphasizes good pedagogy.

LIVE-CODE Teaching Approach
Visual Basic.NET How to Program, Second Edition is loaded with numerous LIVE-CODE examples. This style exemplifies the way we teach and write about programming, as well as being the focus of our multimedia Cyber Classrooms and Web-based training courses. Each new concept is presented in the context of a complete, working example that is immediately followed by one or more windows showing the program's input/output dialog. We call this method of teaching and writing the LIVE-CODE Approach. We use programming languages to teach programming languages. Reading the examples in the text is much like entering and running them on a computer.

World Wide Web Access
All of the examples for Visual Basic .NET How to Program, Second Edition (and our other publications) are available on the Internet as downloads from the following Web sites:

Registration is quick and easy and these downloads are free. We suggest downloading all the examples, then running each program as you read the corresponding text. Making changes to the examples and immediately see the effects of those changes—a great way to learn programming. Each set of instructions assumes that the user is running Windows 2000 or Windows XP and is using Microsoft's Internet Information Services (IIS). Additional setup instructions for Web servers and other software can be found at our Web sites along with the examples. Note: This is copyrighted material. Feel free to use it as you study, but you may not republish any portion of it in any form without explicit permission from Prentice Hall and the authors.

Additionally, Visual Studio .NET, which includes Visual Basic .NET, can be purchased and downloaded from Microsoft. Three different version of Visual Studio .NET are available—Enterprise, Professional and Academic. Visit developerstore.com/devstore/ for more details and to order. If you are a member of the Microsoft Developer Network, visit msdn.microsoft.com/default.asp.

Each chapter begins with objectives that inform students of what to expect and give them an opportunity, after reading the chapter, to determine whether they have met the intended goals. The objectives serve as confidence builders and as a source of positive reinforcement.

The chapter objectives are followed by sets of quotations. Some are humorous, some are philosophical and some offer interesting insights. We have found that students enjoy relating the quotations to the chapter material. Many of the quotations are worth a "second look" after you read each chapter.

The chapter outline enables students to approach the material in top-down fashion. Along with the chapter objectives, the outline helps students anticipate future topics and set a comfortable and effective learning pace.

21,300 Lines of Code in 193 Example Programs (with Program Outputs)
We present Visual Basic .NET features in the context of complete, working Visual Basic .NET programs. The programs range in size from just a few lines of code to substantial examples containing several hundred lines of code. All examples are available on the CD that accompanies the book or as downloads from our Web site, www.deitel.com.

689 Illustrations/Figures
An abundance of charts, line drawings and program outputs is included. The discussion of control structures, for example, features carefully drawn flowcharts. Note: We do not teach flowcharting as a program-development tool, but we do use a brief, flowchart-oriented presentation to explain the precise operation of each Visual Basic .NET control structure.

458 Programming Tips
We have included programming tips to help students focus on important aspects of program development. We highlight hundreds of these tips in the form of Good Programming Practices, Common Programming Errors, Testing and Debugging Tips, Performance Tips, Portability Tips, Software Engineering Observations and Look-and-Feel Observations.

These tips and practices represent the best the authors have gleaned from a combined seven decades of programming and teaching experience. One of our students—a mathematics major—told us that she feels this approach is like the highlighting of axioms, theorems and corollaries in mathematics books; it provides a foundation on which to build good software.

  • 83 Good Programming Practices
    Good Programming Practices are tips that call attention to techniques that will help students produce better programs. When we teach introductory courses to nonprogrammers, we state that the "buzzword" for each course is "clarity," and we tell the students that we will highlight (in these Good Programming Practices) techniques for writing programs that are clearer, more understandable and more maintainable.
  • 136 Common Programming Errors
    Students learning a language—especially in their first programming course—tend to make certain kinds of errors frequently. Pointing out these Common Programming Errors reduces the likelihood that students will make the same mistakes. It also shortens long lines outside instructors' offices during office hours!
  • 49 Testing and Debugging Tips
    When we first designed this "tip type," we thought the tips would contain suggestions strictly for exposing bugs and removing them from programs. In fact, many of the tips describe aspects of Visual Basic.NET that prevent "bugs" from getting into programs in the first place, thus simplifying the testing and debugging process.
  • 49 Performance Tips
    In our experience, teaching students to write clear and understandable programs is by far the most important goal for a first programming course. But students want to write programs that run the fastest, use the least memory, require the smallest number of keystrokes or dazzle in other ways. Students really care about performance and they want to know what they can do to "turbo charge" their programs. We have included 49 Performance Tips that highlight opportunities for improving program performance—making programs run faster or minimizing the amount of memory that they occupy.
  • 14 Portability Tips
    We include Portability Tips to help students write portable code and to provide insights on how Visual Basic.NET achieves its high degree of portability.
  • 102 Software Engineering Observations
    The object-oriented programming paradigm necessitates a complete rethinking of the way we build software systems. Visual Basic .NET is an effective language for achieving good software engineering. The Software Engineering Observations highlight architectural and design issues that affect the construction of software systems, especially large-scale systems. Much of what the student learns here will be useful in upper-level courses and in industry as the student begins to work with large, complex real-world systems.
  • 25 Look-and-Feel Observations
    We provide Look-and-Feel Observations to highlight graphical-user-interface conventions. These observations help students design attractive, user-friendly graphical user interfaces that conform to industry norms.

Summary (1313 Summary bullets)
Each chapter ends with additional pedagogical devices. We present a thorough, bullet-list-style summary of the chapter. On average, there are 41 summary bullets per chapter. This helps the students review and reinforce key concepts.

Terminology (2980 Terms)
We include in a Terminology section an alphabetized list of the important terms defined in the chapter. Again, this serves as further reinforcement. On average, there are 93 terms per chapter. Each term also appears in the index, so the student can locate terms and definitions quickly.

654 Self-Review Exercises and Answers (Count Includes Separate Parts)
Extensive self-review exercises and answers are included for self-study. These questions and answers give the student a chance to build confidence with the material and prepare for the regular exercises. Students should be encouraged to attempt all the self-review exercises and check their answers.

364 Exercises (Solutions in Instructor's Manual; Count Includes Separate Parts)
Each chapter concludes with a substantial set of exercises that involve simple recall of important terminology and concepts; writing individual Visual Basic .NET statements; writing small portions of Visual Basic .NET methods and classes; writing complete Visual Basic .NET methods, classes and applications; and writing major projects. These exercises cover a wide variety of topics, enabling instructors to tailor their courses to the unique needs of their audiences and to vary course assignments each semester. Instructors can use the exercises to form homework assignments, short quizzes and major examinations. The solutions for the exercises are included in the Instructor's Manual and on the disks available only to instructors through their Prentice-Hall representatives. NOTE: Please do not write to us requesting the instructor's manual. Distribution of this publication is strictly limited to college professors teaching from the book. Instructors may obtain the solutions manual from their regular Prentice Hall representatives. We regret that we cannot provide the solutions to professionals. Solutions to approximately half the exercises are included on the Visual Basic. NET Multimedia Cyber Classroom, Second Edition CD-ROM (available in April 2002 at www.InformIT.com/cyberclassrooms; also see the last few pages of this book or visit www.deitel.com for ordering instructions). Also available in April 2002 is the boxed product, The Complete Visual Basic. NET Training Course, Second Edition, which includes both our textbook, Visual Basic .NET How to Program, Second Edition and the Visual Basic.NET Multimedia Cyber Classroom, Second Edition. All of our Complete Training Course products are available at bookstores and online booksellers, including www.InformIT.com.

Approximately 5,400 Index Entries (with approximately 6,750 Page References)
We have included an extensive Index at the back of the book. Using this resource, students can search for any term or concept by keyword. The Index is especially useful to practicing programmers who use the book as a reference. Each of the 2,980 terms in the Terminology sections appears in the Index (along with many more index items from each chapter). Students can use the index in conjunction with the Terminology sections to ensure that they have covered the key material in each chapter.

"Double Indexing" of All Visual Basic.NET LIVE-CODE Examples
Visual Basic .NET How to Program, Second Edition has 193 LIVE-CODE examples and 364 exercises (including parts). Many of the exercises are challenging problems or projects requiring substantial effort. We have "double indexed" each of the LIVE-CODE examples and most of the more challenging exercises. For every Visual Basic .NET source-code program in the book, we took the file name with the .vb extension, such as ChessGame.vb, and indexed it both alphabetically (in this case, under "C") and as a subindex item under "Examples." This makes it easier to find examples using particular features.

Visual Basic.NET Multimedia Cyber Classroom, Second Edition and The Complete Visual Basic. NET Training Course, Second Edition

We have prepared an interactive, CD-ROM-based, software version of Visual Basic .NET How to Program, Second Edition called the Visual Basic .NET Multimedia Cyber Classroom, Second Edition. This resource is loaded with e-Learning features that are ideal for both learning and reference. The Cyber Classroom is packaged with the textbook at a discount in The Complete Visual Basic.NET Training Course, Second Edition. If you already have the book and would like to purchase the Visual Basic.NET Multimedia Cyber Classroom, Second Edition separately, please visit www.InformIT.com/cyberclassrooms. The ISBN number for the Visual Basic .NET Multimedia Cyber Classroom, Second Edition, is 0-13-065193-1. All Deitel Cyber Classrooms are available in CD-ROM and Web-based training formats.

The CD provides an introduction in which the authors overview the Cyber Classroom's features. The textbook's 193 LIVE-CODE® example Visual Basic .NET programs truly "come alive" in the Cyber Classroom. If you are viewing a program and want to execute it, you simply click the lightning-bolt icon, and the program will run. You immediately will see—and hear, when working with audio-based multimedia programs—the program's outputs. If you want to modify a program and see the effects of your changes, simply click the floppy-disk icon that causes the source code to be "lifted off' the CD and "dropped into" one of your own directories so you can edit the text, recompile the program and try out your new version. Click the audio icon, and one of the authors will discuss the program and "walk you through" the code.

The Cyber Classroom also provides navigational aids, including extensive hyperlinking. The Cyber Classroom is browser based, so it remembers sections that you have visited recently and allows you to move forward or backward among these sections. The thousands of index entries are hyperlinked to their text occurrences. Furthermore, when you key in a term using the "find" feature, the Cyber Classroom will locate occurrences of that term throughout the text. The Table of Contents entries are "hot," so clicking a chapter name takes you immediately to that chapter.

Students like the fact that solutions to approximately half the exercises in the book are included with the Cyber Classroom. Studying and running these extra programs is a great way for students to enhance their learning experience.

Students and professional users of our Cyber Classrooms tell us that they like the interactivity and that the Cyber Classroom is an effective reference due to its extensive hyperlinking and other navigational features. We received an email from a person who said that he lives "in the boonies" and cannot take a live course at a university, so the Cyber Classroom provided an ideal solution to his educational needs.

Professors tell us that their students enjoy using the Cyber Classroom and spend more time on the courses and master more of the material than in textbook-only courses. For a complete list of the available and forthcoming Cyber Classrooms and Complete Training Courses, see the Deitel® Series page at the beginning of this book, the product listing and ordering information at the end of this book or visit www.deitel.com, www.prenhall.com/deitel and www.InformIT.com/deitel.

Deitel e-Learning Initiatives

e-Books and Support for Wireless Devices
Wireless devices will play an enormous role in the future of the Internet. Given recent bandwidth enhancements and the emergence of 2.5 and 3G technologies, it is projected that, within two years, more people will access the Internet through wireless devices than through desktop computers. Deitel & Associates, Inc., is committed to wireless accessibility and has recently published Wireless Internet & Mobile Business How to Program. To fulfill the needs of a wide range of customers, we currently are developing our content both in traditional print formats and in newly developed electronic formats, such as e-books so that students and professors can access content virtually anytime, anywhere. Visit www.deitel.com for periodic updates on this initiative.

Deitel & Associates, Inc., is partnering with Prentice Hall's parent company, Pearson PLC, and its information technology Web site, www.InformIT.com, to launch the Deitel e-Matter series at www.InformIT.com/deitel. This series will provide professors, students and professionals with an additional source of information on specific programming topics. e-Matter consists of stand-alone sections taken from published texts, forthcoming texts or pieces written during the Deitel research-and-development process. Developing e-Matter based on pre-publication books allows us to offer significant amounts of the material to early adopters for use in courses. Some possible Visual Basic .NET e-Matter titles we are considering include Object-Based Programming and Object-Oriented Programming in Visual Basic.NET; Graphical User Interface Programming in Visual Basic.NET; Multithreading in Visual Basic .NET; ASP .NET and Web Forms: A Visual Basic .NET View; and ASP .NET and Web Services: A Visual Basic.NET View.

Course Management Systems: WebCT, Blackboard, and CourseCompass
We are working with Prentice Hall to integrate our How to Program Series courseware into three Course Management Systems: WebCT, Blackboard and CourseCompass. These Course Management Systems enable instructors to create, manage and use sophisticated Web-based educational programs. Course Management System features include course customization (such as posting contact information, policies, syllabi, announcements, assignments, grades, performance evaluations and progress tracking), class and student management tools, a gradebook, reporting tools, communication tools (such as chat rooms), a whiteboard, document sharing, bulletin boards and more. Instructors can use these products to communicate with their students, create online quizzes and tests from questions directly linked to the text and automatically grade and track test results. For more information about these upcoming products, visit www.deitel.com/whatsnew.html. For demonstrations of existing WebCT, Blackboard and CourseCompass courses, visit http://cms.prenhall.com/webct/index.html, http://cms.prenhall.com/blackboard/index.html, and http://cms.prenhall.com/coursecompass/index.html respectively.

Deitel and InformIT Newsletters

Deitel Column in the InformIT Newsletters
Deitel & Associates, Inc., contributes a weekly column to the popular InformIT newsletter, currently subscribed to by more than 800,000 IT professionals worldwide. For opt-in registration, visit www.InformIT.com

Deitel Newsletter
Our own free, opt-in newsletter includes commentary on industry trends and developments, links to articles and resources from our published books and upcoming publications, information on future publications, product-release schedules and more. For opt-in registration, visit www.deitel.com.

The Deitel .NET Series

Deitel & Associates, Inc., is making a major commitment to .NET programming through the launch of our.NET Series. Visual Basic.NET How to Program, Second Edition and C# .NET How to Program are the first books in this new series. We intend to follow these books with Advanced Visual Basic.NET How to Program and Advanced C#.NET How to Program, which will be published in December 2002. We also plan to publish Visual C++ .NET How to Program in July 2002, followed by Advanced Visual C++ .NET How to Program in July 2003.

Advanced Visual Basic. NET How to Program

Visual Basic. NET How to Program, Second Edition covers introductory through intermediate-level Visual Basic .NET programming topics, as well as core programming fundamentals. By contrast, our upcoming textbook Advanced Visual Basic .NET How to Program will be geared toward experienced Visual Basic .NET developers. This new book will cover enterprise-level programming topics, including: Creating multi-tier, database intensive ASP.NET applications using ADO.NET and XML; constructing custom Windows controls; developing custom Web controls; and building Windows services. The book also will include more in-depth explanations of object-oriented programming (with the UML), ADO.NET, XML Web services, wireless programming and security. Advanced Visual Basic.NET How to Program will be published in December 2002.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership