Programming Visual Basic .NET, Second Edition

Book description

Programming Visual Basic .NET, Second Edition is the complete guide to application development using Visual Basic .NET. Entirely rewritten by .NET expert Jesse Liberty, the new edition of this tutorial will be essential reading for the millions of Visual Basic programmers looking to make the change to Microsoft's .NET programming environment. Thorough, entertaining, and easy to follow, this book provides a comprehensive and detailed overview of the language, object-oriented programming, and the .NET Framework, and goes even further--you'll learn how to create Windows and Web applications, as well as Web services. A comprehensive introduction to the Visual Basic .NET language, this new edition covers topics of greatest concern to VB6 programmers who wish to make the transition from traditional Visual Basic 6 programming to the new object-oriented, component-based world of .NET. Loaded with practical examples for intermediate and advanced programmers, Programming Visual Basic .NET focuses on turning you into a proficient .NET developer. Some of the topics in the book include:

  • Visual Basic .NET and the .NET Framework

  • Object-Oriented Programming

  • Building Windows Applications

  • Accessing Data with ADO.NET

  • ASP.NET

  • Web Services

  • and much more

Jesse Liberty's books have successfully guided thousands of new and experienced programmers alike into the world of .NET programming and Programming Visual Basic .NET, Second Edition will be no exception. This book is sure to become a key component of developers' .NET libraries.

Table of contents

  1. Programming Visual Basic .NET, 2nd Edition
    1. Preface
      1. About This Book
      2. How This Book Is Organized
        1. Part I
        2. Part II
        3. Part III
      3. Conventions Used in This Book
      4. Support
      5. We’d Like to Hear from You
      6. Acknowledgments
    2. I. The Visual Basic .NET Language
      1. 1. Visual Basic .NET andthe .NET Framework
        1. Visual Basic and .NET
          1. Stepchild No Longer
        2. The .NET Platform
        3. The .NET Framework
        4. Compilation and the MSIL
        5. The VB.NET Language
      2. 2. Getting Started: “Hello World”
        1. Examining Your First Program
          1. Classes and Objects
          2. Namespaces
          3. The WriteLine( ) Method
          4. Comments
        2. Writing and Building Your Programs
          1. Using a Text Editor
          2. Using Visual Studio .NET
            1. Creating the “Hello World” program
            2. Compiling and running “Hello World”
        3. Using the VS.NET Debugger
      3. 3. Language Fundamentals
        1. VB.NET Versus VB6
        2. VB.NET Types
          1. Working with Built-in Types
          2. Choosing a Built-in Type
          3. Converting Built-in Types
        3. Identifiers
        4. Variables and Constants
          1. Default Values
          2. Constants
          3. Enumerations
          4. Strings
        5. Whitespace
        6. Statements
        7. Branching
          1. Unconditional Branching Statements
          2. Conditional Branching Statements
          3. If Statements
          4. If . . . Else Statements
          5. Nested If Statements
          6. ElseIf
          7. IIF: If and Only IF
          8. Select Case Statements
        8. Iteration (Looping) Statements
          1. Creating Loops with Goto
          2. The Do Loop
          3. Breaking Out of a Do Loop
          4. The For Loop
          5. Controlling a For Loop Using Next
        9. Operators
          1. Mathematical Operators
            1. Simple arithmetic operators (+, -, *, /, \)
            2. Self-assignment operators
            3. The modulus operator (Mod) to return remainders
            4. The exponentiation operator (^)
          2. String Concatenation Operators (&, +)
          3. Relational Operators
        10. Logical Operators Within Conditionals
          1. Short-Circuit Evaluation
          2. Operator Precedence
      4. 4. Object-Oriented Programming
        1. Creating Models
        2. Classes and Objects
        3. Class Relationships
        4. The Three Pillars of Object-Oriented Programming
          1. Encapsulation
          2. Specialization and Generalization
          3. Polymorphism
        5. Object-Oriented Analysis and Design
      5. 5. Classes and Objects
        1. Defining Classes
          1. Instantiating Objects
          2. Modules Are Classes
          3. Memory Allocation: The Stack Versus the Heap
          4. Creating a Time Class
          5. Access Modifiers
        2. Method Arguments
        3. Constructors
        4. Initializers
        5. Copy Constructors
        6. The Me Keyword
        7. Using Shared Members
        8. Destroying Objects
        9. Overloading Methods and Constructors
        10. Encapsulating Data with Properties
          1. The Get Accessor
          2. The Set Accessor
          3. ReadOnly and WriteOnly Properties
        11. Passing Parameters by Value and by Reference
          1. Passing Parameters by Value
          2. Passing Parameters by Reference
          3. Passing Reference Types by Value
      6. 6. Inheritance and Polymorphism
        1. Specialization and Generalization
        2. Inheritance
          1. Implementing Inheritance
          2. Calling Base Class Constructors
          3. Shadowing Base Methods
          4. Controlling Access
        3. Polymorphism
          1. Creating Polymorphic Types
          2. Creating Polymorphic Methods
          3. Versioning with Overridable and Overrides
        4. Abstract Methods and Classes
        5. NotInheritable Classes
        6. The Root of All Classes: Object
        7. Boxing and Unboxing Types
          1. Boxing Is Implicit
          2. Unboxing Must Be Explicit
        8. Nested Classes
      7. 7. Structures
        1. Defining a Structure
          1. No Inheritance
          2. No Initialization
          3. Public Member Data?
        2. Calling the Default Constructor
        3. Creating Structures Without New
      8. 8. Interfaces
        1. Defining an Interface
        2. Implementing an Interface
        3. Implementing More Than One Interface
        4. Casting to an Interface
          1. Testing for Interface Implementation
          2. TypeOf...Is
        5. Extending Interfaces
        6. Combining Interfaces
        7. Overriding Interface Implementations
      9. 9. Arrays, Indexers, and Collections
        1. Arrays
          1. Declaring Arrays
          2. The Size of the Array
          3. The ReDim Keyword
          4. Understanding Default Values
          5. Accessing Array Elements
          6. The For Each Statement
          7. Initializing Array Elements
          8. The ParamArray Keyword
        2. Multidimensional Arrays
          1. Rectangular Arrays
          2. Jagged Arrays
        3. System.Array
        4. Indexers and the Default Property
          1. Default Properties and Assignment
          2. Indexing on Other Values
        5. The Collection Interfaces: IEnumerable
        6. .NET Collection Types: Beyond Array
          1. Array Lists
          2. The Collection Class
          3. Queues
          4. Stacks
        7. Copying from a Collection Type to an Array
      10. 10. Strings
        1. Creating Strings
          1. String Literals
          2. The ToString( ) Method
          3. Strings Are Immutable
        2. Manipulating Strings
          1. Comparing Strings
          2. Concatenating Strings
          3. Copying Strings
          4. Testing for Equality
          5. Other Useful String Methods
          6. Finding Substrings
          7. Splitting Strings
          8. The StringBuilder Class
        3. Regular Expressions
        4. The Regex Class
          1. Using Match and MatchCollection
          2. Using Regex Groups
          3. Using CaptureCollection
      11. 11. Exceptions
        1. Throwing and Catching Exceptions
          1. The Throw Statement
          2. The Try and Catch Statements
          3. How the Call Stack Works
          4. Creating Dedicated Catch Statements
          5. The Finally Statement
          6. Exception Class Methods and Properties
          7. Custom Exceptions
        2. Rethrowing Exceptions
      12. 12. Delegates and Events
        1. Delegates
          1. Using Delegates to Specify Methods at Runtime
          2. Shared Delegates
          3. Delegates as Properties
        2. Multicasting
        3. Delegates and Callback Mechanisms
        4. Events
          1. Publishing and Subscribing
          2. Events and Delegates
    3. II. Programming with VB.NET
      1. 13. Building Windows Applications
        1. Creating a Simple Windows Form
          1. Using Notepad
          2. Using the Visual Studio .NET Designer
        2. Creating a Windows Forms Application
          1. Creating the Basic UI Form
          2. Populating the TreeView Controls
            1. TreeNode objects
            2. Recursing through the subdirectories
            3. Getting the files in the directory
            4. Begin and EndUpdate
          3. Handling TreeView Events
            1. Clicking the source TreeView
            2. Clicking the target TreeView
            3. Handling the Clear button event
          4. Implementing the Copy Button Event
            1. Getting the selected files
            2. Sorting the list of selected files
          5. Handling the Delete Button Event
        3. Deploying an Application
          1. Deployment Projects
          2. Setup Project
          3. Deployment Locations
            1. Creating a shortcut
            2. Entries in My Documents
            3. Shortcuts in the Start menu
          4. Adding Special Folders
          5. Other View Windows
            1. Making changes to the Registry
            2. Registering file types
            3. Managing the UI during Setup
            4. Other View choices
          6. Building the Setup Project
      2. 14. Accessing Datawith ADO.NET
        1. Relational Databases and SQL
          1. Tables, Records, and Columns
          2. Normalization
          3. Declarative Referential Integrity
          4. SQL
        2. The ADO.NET Object Model
          1. DataTables and DataColumns
          2. DataRelations
          3. Rows
          4. Data Adapter
          5. DBCommand and DBConnection
          6. The DataAdapter Object
        3. Getting Started with ADO.NET
        4. Using ADO Managed Providers
        5. Working with Data-Bound Controls
          1. Populating a DataGrid
          2. Customizing the DataSet
          3. Combining Data Tables
        6. Changing Database Records
          1. Accessing the Data
          2. Updating a Record
          3. Deleting a Record
          4. Creating New Records
        7. ADO.NET and XML
      3. 15. Building Web Applicationswith Web Forms
        1. Understanding Web Forms
          1. Web Form Events
            1. Postback versus non-postback events
            2. State
          2. Web Form Life Cycle
        2. Creating a Web Form
        3. Adding Controls
        4. Data Binding
          1. Setting Initial Properties
          2. Connecting to the Database
        5. Responding to Postback Events
      4. 16. Programming Web Services
        1. SOAP, WSDL, and Discovery
          1. Server-Side Support
          2. Client-Side Support
        2. Building a Web Service
          1. Testing Your Web Service
          2. Viewing the WSDL Contract
        3. Creating the Proxy
    4. III. VB.NET and the .NET CLR
      1. 17. Assemblies and Versioning
        1. PE Files
        2. Metadata
        3. Security Boundary
        4. Versioning
        5. Manifests
          1. Modules in the Manifest
          2. Module Manifests
          3. Other Required Assemblies
        6. Multi-Module Assemblies
          1. Benefitting from Multi-Module Assemblies
          2. Building a Multi-Module Assembly
            1. Testing the assembly
            2. Loading the assembly
        7. Private Assemblies
        8. Shared Assemblies
          1. The End of DLL Hell
          2. Versions
          3. Strong Names
          4. The Global Assembly Cache
          5. Building a Shared Assembly
            1. Step 1: Create a strong name
            2. Step 2: Put the shared assembly in the GAC
      2. 18. Attributes and Reflection
        1. Attributes
          1. Intrinsic Attributes
            1. Attribute targets
            2. Applying attributes
          2. Custom Attributes
            1. Declaring an attribute
            2. Naming an attribute
            3. Constructing an attribute
            4. Using an attribute
        2. Reflection
          1. Viewing MetaData
          2. Type Discovery
          3. Reflecting on a Type
            1. Finding all type members
            2. Finding type methods
            3. Finding particular type members
          4. Late Binding
          5. Reflection Emit
            1. Dynamic invocation with InvokeMember( )
            2. Dynamic invocation with interfaces
            3. Dynamic invocation with reflection emit
      3. 19. Marshaling and Remoting
        1. Application Domains
          1. Creating and Using App Domains
          2. Marshaling Across App Domain Boundaries
            1. Understanding marshaling with proxies
            2. Specifying the marshaling method
        2. Context
          1. Context-Bound and Context-Agile Objects
          2. Marshaling Across Context Boundaries
        3. Remoting
          1. Understanding Server Object Types
          2. Specifying a Server with an Interface
          3. Building a Server
          4. Building the Client
          5. Using SingleCall
          6. Understanding RegisterWellKnownServiceType
          7. Understanding Endpoints
      4. 20. Threads and Synchronization
        1. Threads
          1. Starting Threads
          2. Joining Threads
          3. Suspending Threads
          4. Killing Threads
        2. Synchronization
          1. Using Interlocked
          2. Using the SyncLock Statement
          3. Using Monitors
        3. Race Conditions and Deadlocks
          1. Race Conditions
          2. Deadlock
    5. Index
    6. Colophon

Product information

  • Title: Programming Visual Basic .NET, Second Edition
  • Author(s):
  • Release date: April 2003
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596004385