You are previewing Visual Basic® 2010 Programmer's Reference.
O'Reilly logo
Visual Basic® 2010 Programmer's Reference

Book Description

Visual Basic expert Rod Stephens shows you how to leverage the latest features of VB 2010

Microsoft Visual Basic (VB) is the most popular programming language in the world, with millions of lines of code used in businesses and applications of all types and sizes. The new release of Visual Basic 2010 is tightly integrated with the Windows operating system and the .NET programming environment. Renowned VB authority Rod Stephens provides a comprehensive guide to Visual Basic programming, including the latest enhancements to the VB language and programming environment with Visual Studio 2010 The tutorial is packed with detailed and practical code examples that show readers how to master all of the features of VB.

  • Visual Basic authority Rod Stephens presents a must-have resource on Visual Basic, the most popular programming language in the word

  • Fully covers the newest features of Visual Basic 2010, such as array literals and initializers, collection initializers, implicit line continuation, Lambda expressions, and more

  • Features extensively revised and tested code to ensure compliance with the latest release

With this essential resource, you'll be able to quickly review the details of important programming, objects, properties, methods, and events.

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of Contents

  1. Copyright
  2. ABOUT THE AUTHOR
  3. CREDITS
  4. ACKNOWLEDGMENTS
  5. INTRODUCTION
    1. SHOULD YOU USE VISUAL BASIC 2010?
    2. WHO SHOULD READ THIS BOOK
    3. HOW THIS BOOK IS ORGANIZED
      1. Part I: IDE
      2. Part II: Getting Started
      3. Part III: Object-Oriented Programming
      4. Part IV: Graphics
      5. Part V: Interacting with the Environment
      6. Part VI: Appendixes
    4. BONUS CHAPTERS
    5. HOW TO USE THIS BOOK
    6. NECESSARY EQUIPMENT
    7. CONVENTIONS
    8. SOURCE CODE
    9. ERRATA
    10. P2P.WROX.COM
    11. IMPORTANT URLS
  6. I. IDE
    1. 1. Introduction to the IDE
      1. 1.1. DIFFERENT IDE APPEARANCES
      2. 1.2. IDE CONFIGURATIONS
      3. 1.3. PROJECTS AND SOLUTIONS
      4. 1.4. STARTING THE IDE
      5. 1.5. CREATING A PROJECT
      6. 1.6. SAVING A PROJECT
      7. 1.7. SUMMARY
    2. 2. Menus, Toolbars, and Windows
      1. 2.1. MENUS
        1. 2.1.1. File
        2. 2.1.2. Edit
        3. 2.1.3. View
        4. 2.1.4. Project
        5. 2.1.5. Build
        6. 2.1.6. Debug
        7. 2.1.7. Data
        8. 2.1.8. Format
        9. 2.1.9. Tools
          1. 2.1.9.1. Macros
          2. 2.1.9.2. Options
        10. 2.1.10. Test
        11. 2.1.11. Help
      2. 2.2. TOOLBARS
      3. 2.3. SECONDARY WINDOWS
        1. 2.3.1. Toolbox
        2. 2.3.2. Properties Window
      4. 2.4. SUMMARY
    3. 3. Customization
      1. 3.1. ADDING COMMANDS
      2. 3.2. MAKING KEYBOARD SHORTCUTS
      3. 3.3. SUMMARY
    4. 4. Windows Forms Designer
      1. 4.1. SETTING DESIGNER OPTIONS
      2. 4.2. ADDING CONTROLS
      3. 4.3. SELECTING CONTROLS
      4. 4.4. COPYING CONTROLS
      5. 4.5. MOVING AND SIZING CONTROLS
      6. 4.6. ARRANGING CONTROLS
      7. 4.7. SETTING PROPERTIES
        1. 4.7.1. Setting Group Properties
        2. 4.7.2. Setting Different Properties for Several Controls
        3. 4.7.3. Using Smart Tags
      8. 4.8. ADDING CODE TO CONTROLS
      9. 4.9. SUMMARY
    5. 5. WPF Designer
      1. 5.1. EDITOR WEAKNESSES
      2. 5.2. RECOGNIZING DESIGNER WINDOWS
      3. 5.3. ADDING CONTROLS
      4. 5.4. SELECTING CONTROLS
      5. 5.5. COPYING CONTROLS
      6. 5.6. MOVING AND SIZING CONTROLS
      7. 5.7. SETTING PROPERTIES
      8. 5.8. SETTING GROUP PROPERTIES
      9. 5.9. ADDING CODE TO CONTROLS
      10. 5.10. SUMMARY
    6. 6. Visual Basic Code Editor
      1. 6.1. MARGIN ICONS
      2. 6.2. OUTLINING
      3. 6.3. TOOLTIPS
      4. 6.4. INTELLISENSE
      5. 6.5. CODE COLORING AND HIGHLIGHTING
      6. 6.6. CODE SNIPPETS
        1. 6.6.1. Using Snippets
        2. 6.6.2. Creating Snippets
      7. 6.7. ARCHITECTURAL TOOLS
        1. 6.7.1. Rename
        2. 6.7.2. Go To Definition
        3. 6.7.3. Go To Type Definition
        4. 6.7.4. Highlight References
        5. 6.7.5. Find All References
        6. 6.7.6. Generate From Usage
      8. 6.8. THE CODE EDITOR AT RUNTIME
      9. 6.9. SUMMARY
    7. 7. Debugging
      1. 7.1. THE DEBUG MENU
      2. 7.2. THE DEBUG WINDOWS SUBMENU
      3. 7.3. THE BREAKPOINTS WINDOW
      4. 7.4. THE COMMAND AND IMMEDIATE WINDOWS
      5. 7.5. SUMMARY
  7. II. Getting Started
    1. 8. Selecting Windows Forms Controls
      1. 8.1. CONTROLS OVERVIEW
      2. 8.2. CHOOSING CONTROLS
        1. 8.2.1. Containing and Arranging Controls
        2. 8.2.2. Making Selections
        3. 8.2.3. Entering Data
        4. 8.2.4. Displaying Data
        5. 8.2.5. Providing Feedback
        6. 8.2.6. Initiating Action
        7. 8.2.7. Displaying Graphics
        8. 8.2.8. Displaying Dialog Boxes
        9. 8.2.9. Supporting Other Controls
      3. 8.3. THIRD-PARTY CONTROLS
      4. 8.4. SUMMARY
    2. 9. Using Windows Forms Controls
      1. 9.1. CONTROLS AND COMPONENTS
      2. 9.2. CREATING CONTROLS
        1. 9.2.1. Creating Controls at Design Time
        2. 9.2.2. Adding Controls to Containers
        3. 9.2.3. Creating Controls at Runtime
      3. 9.3. PROPERTIES
        1. 9.3.1. Properties at Design Time
          1. 9.3.1.1. Compound Properties
          2. 9.3.1.2. Restricted Properties
          3. 9.3.1.3. Collection Properties
        2. 9.3.2. Properties at Runtime
        3. 9.3.3. Useful Control Properties
          1. 9.3.3.1. Anchor
          2. 9.3.3.2. Dock
        4. 9.3.4. Position and Size Properties
      4. 9.4. METHODS
      5. 9.5. EVENTS
        1. 9.5.1. Creating Event Handlers at Design Time
        2. 9.5.2. WithEvents Event Handlers
        3. 9.5.3. Setting Event Handlers at Runtime
        4. 9.5.4. Control Array Events
        5. 9.5.5. Validation Events
          1. 9.5.5.1. Integrated Validation
          2. 9.5.5.2. Separated Validation
          3. 9.5.5.3. Deferred Validation
      6. 9.6. SUMMARY
    3. 10. Windows Forms
      1. 10.1. TRANSPARENCY
      2. 10.2. ABOUT, SPLASH, AND LOGIN FORMS
      3. 10.3. MOUSE CURSORS
      4. 10.4. ICONS
        1. 10.4.1. Application Icons
        2. 10.4.2. Notification Icons
      5. 10.5. PROPERTIES ADOPTED BY CHILD CONTROLS
      6. 10.6. PROPERTY RESET METHODS
      7. 10.7. OVERRIDING WNDPROC
      8. 10.8. SDI AND MDI
        1. 10.8.1. MDI Features
        2. 10.8.2. MDI Events
        3. 10.8.3. MDI versus SDI
      9. 10.9. MRU LISTS
      10. 10.10. DIALOG BOXES
      11. 10.11. WIZARDS
      12. 10.12. SUMMARY
    4. 11. Selecting WPF Controls
      1. 11.1. CONTROLS OVERVIEW
      2. 11.2. CONTAINING AND ARRANGING CONTROLS
      3. 11.3. MAKING SELECTIONS
      4. 11.4. ENTERING DATA
      5. 11.5. DISPLAYING DATA
      6. 11.6. PROVIDING FEEDBACK
      7. 11.7. INITIATING ACTION
      8. 11.8. PRESENTING GRAPHICS AND MEDIA
      9. 11.9. PROVIDING NAVIGATION
      10. 11.10. MANAGING DOCUMENTS
      11. 11.11. DIGITAL INK
      12. 11.12. SUMMARY
    5. 12. Using WPF Controls
      1. 12.1. WPF CONCEPTS
        1. 12.1.1. Separation of User Interface and Code
        2. 12.1.2. WPF Control Hierarchies
      2. 12.2. WPF IN THE IDE
        1. 12.2.1. Editing XAML
        2. 12.2.2. Editing Visual Basic Code
      3. 12.3. XAML FEATURES
        1. 12.3.1. Objects
        2. 12.3.2. Resources
        3. 12.3.3. Styles
        4. 12.3.4. Templates
        5. 12.3.5. Transformations
        6. 12.3.6. Animations
        7. 12.3.7. Drawing Objects
          1. 12.3.7.1. Line
          2. 12.3.7.2. Ellipse
          3. 12.3.7.3. Rectangle
          4. 12.3.7.4. Polygon
          5. 12.3.7.5. Polyline
          6. 12.3.7.6. Path
      4. 12.4. PROCEDURAL WPF
      5. 12.5. DOCUMENTS
        1. 12.5.1. Flow Documents
        2. 12.5.2. Fixed Documents
        3. 12.5.3. XPS Documents
      6. 12.6. SUMMARY
    6. 13. WPF Windows
      1. 13.1. WINDOW APPLICATIONS
      2. 13.2. PAGE APPLICATIONS
        1. 13.2.1. Browser Applications
        2. 13.2.2. Frame Applications
        3. 13.2.3. PageFunction Applications
        4. 13.2.4. Wizard Applications
      3. 13.3. SUMMARY
    7. 14. Program and Module Structure
      1. 14.1. HIDDEN FILES
      2. 14.2. CODE FILE STRUCTURE
        1. 14.2.1. Code Regions
        2. 14.2.2. Conditional Compilation
          1. 14.2.2.1. Setting Constants in Code
          2. 14.2.2.2. Setting Constants with the Project's Compilation Settings
          3. 14.2.2.3. Predefined Constants
          4. 14.2.2.4. DEBUG
            1. 14.2.2.4.1. Assert
            2. 14.2.2.4.2. Fail
            3. 14.2.2.4.3. IndentSize, Indent, Unindent, and IndentLevel
            4. 14.2.2.4.4. Write, WriteLine, WriteIf, and WriteLineIf
          5. 14.2.2.5. TRACE
          6. 14.2.2.6. CONFIG
          7. 14.2.2.7. Debugging Level Constants
        3. 14.2.3. Namespaces
      3. 14.3. TYPOGRAPHIC CODE ELEMENTS
        1. 14.3.1. Comments
        2. 14.3.2. XML Comments
        3. 14.3.3. Line Continuation
        4. 14.3.4. Implicit Line Continuation
        5. 14.3.5. Line Joining
        6. 14.3.6. Line Labels
      4. 14.4. SUMMARY
    8. 15. Data Types, Variables, and Constants
      1. 15.1. DATA TYPES
      2. 15.2. TYPE CHARACTERS
      3. 15.3. DATA TYPE CONVERSION
        1. 15.3.1. Narrowing Conversions
        2. 15.3.2. Data Type Parsing Methods
        3. 15.3.3. Widening Conversions
        4. 15.3.4. The Convert Class
        5. 15.3.5. ToString
      4. 15.4. VARIABLE DECLARATIONS
        1. 15.4.1. Attribute_List
        2. 15.4.2. Accessibility
        3. 15.4.3. Shared
        4. 15.4.4. Shadows
        5. 15.4.5. ReadOnly
        6. 15.4.6. Dim
        7. 15.4.7. WithEvents
        8. 15.4.8. Name
        9. 15.4.9. Bounds_List
        10. 15.4.10. New
        11. 15.4.11. As Type and Inferred Types
        12. 15.4.12. Initialization_Expression
          1. 15.4.12.1. Initializing Arrays
          2. 15.4.12.2. Initializing Object Arrays
          3. 15.4.12.3. Initializing XML Variables
      5. 15.5. INITIALIZING COLLECTIONS
        1. 15.5.1. Multiple Variable Declarations
      6. 15.6. OPTION EXPLICIT AND OPTION STRICT
      7. 15.7. SCOPE
        1. 15.7.1. Block Scope
        2. 15.7.2. Procedure Scope
        3. 15.7.3. Module Scope
        4. 15.7.4. Namespace Scope
        5. 15.7.5. Restricting Scope
      8. 15.8. PARAMETER DECLARATIONS
      9. 15.9. PROPERTY PROCEDURES
      10. 15.10. ENUMERATED DATA TYPES
      11. 15.11. ANONYMOUS TYPES
      12. 15.12. NULLABLE TYPES
      13. 15.13. CONSTANTS
        1. 15.13.1. Accessibility
        2. 15.13.2. As Type
        3. 15.13.3. Initialization_Expression
      14. 15.14. DELEGATES
      15. 15.15. NAMING CONVENTIONS
      16. 15.16. SUMMARY
    9. 16. Operators
      1. 16.1. ARITHMETIC OPERATORS
      2. 16.2. CONCATENATION OPERATORS
      3. 16.3. COMPARISON OPERATORS
      4. 16.4. LOGICAL OPERATORS
      5. 16.5. BITWISE OPERATORS
      6. 16.6. OPERATOR PRECEDENCE
      7. 16.7. ASSIGNMENT OPERATORS
      8. 16.8. THE STRINGBUILDER CLASS
      9. 16.9. DATE AND TIMESPAN OPERATIONS
      10. 16.10. OPERATOR OVERLOADING
      11. 16.11. OPERATORS WITH NULLABLE TYPES
      12. 16.12. SUMMARY
    10. 17. Subroutines and Functions
      1. 17.1. SUBROUTINES
        1. 17.1.1. Attribute_List
        2. 17.1.2. Inheritance_Mode
        3. 17.1.3. Accessibility
        4. 17.1.4. Subroutine_Name
        5. 17.1.5. Parameters
          1. 17.1.5.1. ByVal
          2. 17.1.5.2. ByRef
          3. 17.1.5.3. Arrays Declared ByVal and ByRef
          4. 17.1.5.4. Parenthesized Parameters
          5. 17.1.5.5. Optional
          6. 17.1.5.6. Optional versus Overloading
          7. 17.1.5.7. Parameter Arrays
        6. 17.1.6. Implements interface.subroutine
        7. 17.1.7. Statements
      2. 17.2. FUNCTIONS
      3. 17.3. PROPERTY PROCEDURES
      4. 17.4. EXTENSION METHODS
      5. 17.5. LAMBDA FUNCTIONS
      6. 17.6. RELAXED DELEGATES
      7. 17.7. PARTIAL METHODS
      8. 17.8. SUMMARY
    11. 18. Program Control Statements
      1. 18.1. DECISION STATEMENTS
        1. 18.1.1. Single-Line If Then
        2. 18.1.2. Multiline If Then
        3. 18.1.3. Select Case
          1. 18.1.3.1. To
          2. 18.1.3.2. Is
          3. 18.1.3.3. Comma-Separated Expressions
        4. 18.1.4. Enumerated Values
        5. 18.1.5. IIf
        6. 18.1.6. If
        7. 18.1.7. Choose
      2. 18.2. LOOPING STATEMENTS
        1. 18.2.1. For Next
        2. 18.2.2. Non-Integer For Next Loops
        3. 18.2.3. For Each
        4. 18.2.4. Enumerators
        5. 18.2.5. Iterators
        6. 18.2.6. Do Loop Statements
        7. 18.2.7. While End
        8. 18.2.8. Exit and Continue
      3. 18.3. GOTO
      4. 18.4. SUMMARY
    12. 19. Error Handling
      1. 19.1. BUGS VERSUS UNPLANNED CONDITIONS
        1. 19.1.1. Catching Bugs
        2. 19.1.2. Catching Unplanned Conditions
        3. 19.1.3. Global Exception Handling
      2. 19.2. STRUCTURED ERROR HANDLING
        1. 19.2.1. Exception Objects
        2. 19.2.2. StackTrace Objects
        3. 19.2.3. Throwing Exceptions
        4. 19.2.4. Re-throwing Exceptions
        5. 19.2.5. Custom Exceptions
      3. 19.3. VISUAL BASIC CLASSIC ERROR HANDLING
        1. 19.3.1. On Error GoTo Line
        2. 19.3.2. On Error Resume Next
        3. 19.3.3. On Error GoTo 0
        4. 19.3.4. On Error GoTo −1
        5. 19.3.5. Error-Handling Mode
      4. 19.4. STRUCTURED VERSUS CLASSIC ERROR HANDLING
      5. 19.5. THE ERR OBJECT
      6. 19.6. DEBUGGING
      7. 19.7. SUMMARY
    13. 20. Database Controls and Objects
      1. 20.1. AUTOMATICALLY CONNECTING TO DATA
        1. 20.1.1. Connecting to the Data Source
        2. 20.1.2. Adding Data Controls to the Form
      2. 20.2. AUTOMATICALLY CREATED OBJECTS
      3. 20.3. OTHER DATA OBJECTS
      4. 20.4. DATA OVERVIEW
      5. 20.5. CONNECTION OBJECTS
      6. 20.6. TRANSACTION OBJECTS
      7. 20.7. DATA ADAPTERS
      8. 20.8. COMMAND OBJECTS
        1. 20.8.1. DataSet
        2. 20.8.2. DataTable
        3. 20.8.3. DataRow
        4. 20.8.4. DataColumn
        5. 20.8.5. DataRelation
        6. 20.8.6. Constraints
          1. 20.8.6.1. ForeignKeyConstraint
          2. 20.8.6.2. UniqueConstraint
      9. 20.9. DATAVIEW
      10. 20.10. DATAROWVIEW
      11. 20.11. SIMPLE DATA BINDING
      12. 20.12. CURRENCYMANAGER
      13. 20.13. COMPLEX DATA BINDING
      14. 20.14. SUMMARY
    14. 21. LINQ
      1. 21.1. INTRODUCTION TO LINQ
      2. 21.2. BASIC LINQ QUERY SYNTAX
        1. 21.2.1. From
        2. 21.2.2. Where
        3. 21.2.3. Order By
        4. 21.2.4. Select
        5. 21.2.5. Using LINQ Results
      3. 21.3. ADVANCED LINQ QUERY SYNTAX
        1. 21.3.1. Join
        2. 21.3.2. Group By
        3. 21.3.3. Aggregate Functions
        4. 21.3.4. Set Operations
        5. 21.3.5. Limiting Results
      4. 21.4. LINQ FUNCTIONS
      5. 21.5. LINQ EXTENSION METHODS
        1. 21.5.1. Method-Based Queries
        2. 21.5.2. Method-Based Queries with Lambda Functions
        3. 21.5.3. Extending LINQ
      6. 21.6. LINQ TO OBJECTS
      7. 21.7. LINQ TO XML
        1. 21.7.1. XML Literals
        2. 21.7.2. LINQ Into XML
        3. 21.7.3. LINQ Out Of XML
      8. 21.8. LINQ TO ADO.NET
        1. 21.8.1. LINQ to SQL and LINQ to Entities
        2. 21.8.2. LINQ to DataSet
      9. 21.9. PLINQ
      10. 21.10. SUMMARY
    15. 22. Custom Controls
      1. 22.1. CUSTOM CONTROLS IN GENERAL
        1. 22.1.1. Create the Control Project
        2. 22.1.2. Make a Toolbox Icon
        3. 22.1.3. Test in the UserControl Test Container
        4. 22.1.4. Make a Test Project
        5. 22.1.5. Test the Control in the Test Project
        6. 22.1.6. Implement Properties, Methods, and Events
      2. 22.2. OTHER CUSTOM CONTROL TASKS
        1. 22.2.1. Add the Control to the Toolbox
        2. 22.2.2. Assign Attributes
        3. 22.2.3. Manage Design Time and Runtime
      3. 22.3. DERIVED CONTROLS
        1. 22.3.1. Shadowing Parent Features
        2. 22.3.2. Hiding Parent Features
      4. 22.4. COMPOSITE CONTROLS
      5. 22.5. CONTROLS BUILT FROM SCRATCH
      6. 22.6. COMPONENTS
      7. 22.7. INVISIBLE CONTROLS
      8. 22.8. PICKING A CONTROL CLASS
      9. 22.9. CONTROLS AND COMPONENTS IN EXECUTABLE PROJECTS
        1. 22.9.1. UserControls in Executable Projects
        2. 22.9.2. Inherited UserControls in Executable Projects
        3. 22.9.3. Controls in Executable Projects
        4. 22.9.4. Inherited Controls in Executable Projects
        5. 22.9.5. Components in Executable Projects
      10. 22.10. CUSTOM COMPONENT SECURITY
        1. 22.10.1. Strongly Named Assemblies
        2. 22.10.2. Using a Signature Authority
      11. 22.11. SUMMARY
    16. 23. Drag and Drop, and the Clipboard
      1. 23.1. DRAG-AND-DROP EVENTS
        1. 23.1.1. A Simple Example
        2. 23.1.2. Learning Data Types Available
        3. 23.1.3. Dragging within an Application
        4. 23.1.4. Accepting Dropped Files
        5. 23.1.5. Dragging Serializable Objects
        6. 23.1.6. Changing Format Names
        7. 23.1.7. Dragging Multiple Data Formats
      2. 23.2. USING THE CLIPBOARD
      3. 23.3. SUMMARY
    17. 24. UAC Security
      1. 24.1. UAC OVERVIEW
      2. 24.2. DESIGNING FOR UAC
      3. 24.3. ELEVATING PROGRAMS
        1. 24.3.1. User
        2. 24.3.2. Calling Program
        3. 24.3.3. Called Program
      4. 24.4. SUMMARY
  8. III. Object-Oriented Programming
    1. 25. OOP Concepts
      1. 25.1. CLASSES
      2. 25.2. ENCAPSULATION
      3. 25.3. INHERITANCE
        1. 25.3.1. Inheritance Hierarchies
        2. 25.3.2. Refinement and Abstraction
        3. 25.3.3. "Has-a" and "Is-a" Relationships
        4. 25.3.4. Adding and Modifying Class Features
        5. 25.3.5. Interface Inheritance
      4. 25.4. POLYMORPHISM
      5. 25.5. METHOD OVERLOADING
      6. 25.6. EXTENSION METHODS
      7. 25.7. SUMMARY
    2. 26. Classes and Structures
      1. 26.1. CLASSES
        1. 26.1.1. Attribute_list
        2. 26.1.2. Partial
        3. 26.1.3. Accessibility
        4. 26.1.4. Shadows
        5. 26.1.5. Inheritance
          1. 26.1.5.1. Of type_list
          2. 26.1.5.2. Inherits parent_class
        6. 26.1.6. Implements interface
      2. 26.2. STRUCTURES
        1. 26.2.1. Structures Cannot Inherit
        2. 26.2.2. Structures Are Value Types
        3. 26.2.3. Memory Required
        4. 26.2.4. Heap and Stack Performance
        5. 26.2.5. Object Assignment
        6. 26.2.6. Parameter Passing
        7. 26.2.7. Boxing and Unboxing
      3. 26.3. CLASS INSTANTIATION DETAILS
      4. 26.4. STRUCTURE INSTANTIATION DETAILS
      5. 26.5. GARBAGE COLLECTION
        1. 26.5.1. Finalize
        2. 26.5.2. Dispose
      6. 26.6. CONSTANTS, PROPERTIES, AND METHODS
      7. 26.7. EVENTS
        1. 26.7.1. Declaring Events
          1. 26.7.1.1. attribute_list
          2. 26.7.1.2. accessibility
          3. 26.7.1.3. Shadows
          4. 26.7.1.4. parameters
          5. 26.7.1.5. Implements interface.event
        2. 26.7.2. Raising Events
        3. 26.7.3. Catching Events
        4. 26.7.4. Declaring Custom Events
        5. 26.7.5. Shared Variables
        6. 26.7.6. Shared Methods
      8. 26.8. SUMMARY
    3. 27. Namespaces
      1. 27.1. THE IMPORTS STATEMENT
        1. 27.1.1. Automatic Imports
        2. 27.1.2. Namespace Aliases
        3. 27.1.3. Namespace Elements
      2. 27.2. THE ROOT NAMESPACE
      3. 27.3. MAKING NAMESPACES
      4. 27.4. CLASSES, STRUCTURES, AND MODULES
      5. 27.5. RESOLVING NAMESPACES
      6. 27.6. SUMMARY
    4. 28. Collection Classes
      1. 28.1. WHAT IS A COLLECTION?
      2. 28.2. ARRAYS
        1. 28.2.1. Array Dimensions
        2. 28.2.2. Lower Bounds
        3. 28.2.3. Resizing
        4. 28.2.4. Speed
        5. 28.2.5. Other Array Class Features
          1. 28.2.5.1. Array.Reverse
          2. 28.2.5.2. Array.Sort
          3. 28.2.5.3. Array.BinarySearch
      3. 28.3. COLLECTIONS
        1. 28.3.1. ArrayList
        2. 28.3.2. StringCollection
        3. 28.3.3. Strongly Typed Collections
        4. 28.3.4. Read-Only Strongly Typed Collections
        5. 28.3.5. NameValueCollection
      4. 28.4. DICTIONARIES
        1. 28.4.1. ListDictionary
        2. 28.4.2. Hashtable
        3. 28.4.3. HybridDictionary
        4. 28.4.4. Strongly Typed Dictionaries
        5. 28.4.5. Other Strongly Typed Derived Classes
        6. 28.4.6. StringDictionary
        7. 28.4.7. SortedList
      5. 28.5. COLLECTIONSUTIL
      6. 28.6. STACKS AND QUEUES
        1. 28.6.1. Stack
        2. 28.6.2. Queue
      7. 28.7. GENERICS
      8. 28.8. COLLECTION INITIALIZERS
      9. 28.9. SUMMARY
    5. 29. Generics
      1. 29.1. ADVANTAGES OF GENERICS
      2. 29.2. DEFINING GENERICS
        1. 29.2.1. Generic Constructors
        2. 29.2.2. Multiple Types
        3. 29.2.3. Constrained Types
      3. 29.3. USING GENERICS
        1. 29.3.1. Imports Aliases
        2. 29.3.2. Derived Classes
      4. 29.4. PREDEFINED GENERIC CLASSES
      5. 29.5. GENERIC METHODS
      6. 29.6. GENERICS AND EXTENSION METHODS
      7. 29.7. SUMMARY
  9. IV. Graphics
    1. 30. Drawing Basics
      1. 30.1. DRAWING OVERVIEW
      2. 30.2. DRAWING NAMESPACES
        1. 30.2.1. System.Drawing
        2. 30.2.2. System.Drawing.Drawing2D
        3. 30.2.3. System.Drawing.Imaging
        4. 30.2.4. System.Drawing.Text
        5. 30.2.5. System.Drawing.Printing
      3. 30.3. GRAPHICS
        1. 30.3.1. Drawing Methods
          1. 30.3.1.1. DrawBezier
          2. 30.3.1.2. DrawBeziers
          3. 30.3.1.3. DrawClosedCurve
          4. 30.3.1.4. DrawPath
        2. 30.3.2. Flling Methods
        3. 30.3.3. Other Graphics Properties and Methods
        4. 30.3.4. Anti-Aliasing
          1. 30.3.4.1. SmoothingMode
          2. 30.3.4.2. TextRenderingHint
          3. 30.3.4.3. InterpolationMode
          4. 30.3.4.4. Speed Considerations
        5. 30.3.5. Transformation Basics
          1. 30.3.5.1. Transformation Mathematics
          2. 30.3.5.2. Transformation Code
        6. 30.3.6. Advanced Transformations
        7. 30.3.7. Saving and Restoring Graphics State
      4. 30.4. DRAWING EVENTS
      5. 30.5. SUMMARY
    2. 31. Brushes, Pens, and Paths
      1. 31.1. PEN
        1. 31.1.1. Alignment
        2. 31.1.2. CompoundArray
        3. 31.1.3. Custom Line Caps
        4. 31.1.4. Pen Transformations
      2. 31.2. BRUSH
        1. 31.2.1. SolidBrush
        2. 31.2.2. TextureBrush
        3. 31.2.3. HatchBrush
        4. 31.2.4. LinearGradientBrush
        5. 31.2.5. PathGradientBrush
      3. 31.3. GRAPHICSPATH OBJECTS
      4. 31.4. GARBAGE-COLLECTION ISSUES
      5. 31.5. SUMMARY
    3. 32. Text
      1. 32.1. DRAWING TEXT
      2. 32.2. TEXT FORMATTING
        1. 32.2.1. FormatFlags
        2. 32.2.2. Tab Stops
        3. 32.2.3. Trimming
      3. 32.3. MEASURESTRING
      4. 32.4. FONT METRICS
      5. 32.5. SUMMARY
    4. 33. Image Processing
      1. 33.1. IMAGE
      2. 33.2. BITMAP
        1. 33.2.1. Loading Bitmaps
        2. 33.2.2. Saving Bitmaps
        3. 33.2.3. Implementing AutoRedraw
        4. 33.2.4. Pixel-by-Pixel Operations
          1. 33.2.4.1. GetPixel and SetPixel
          2. 33.2.4.2. Unsafe Pixel Manipulation
      3. 33.3. METAFILE OBJECTS
      4. 33.4. SUMMARY
    5. 34. Printing
      1. 34.1. HOW NOT TO PRINT
      2. 34.2. BASIC PRINTING
      3. 34.3. PRINTING TEXT
      4. 34.4. CENTERING PRINTOUTS
      5. 34.5. FITTING PICTURES TO THE PAGE
      6. 34.6. SIMPLIFYING DRAWING AND PRINTING
      7. 34.7. SUMMARY
  10. V. Interacting with the Environment
    1. 35. Configuration and Resources
      1. 35.1. MY
        1. 35.1.1. Me and My
        2. 35.1.2. My Sections
      2. 35.2. ENVIRONMENT
        1. 35.2.1. Setting Environment Variables
        2. 35.2.2. Using Environ
        3. 35.2.3. Using System.Environment
      3. 35.3. REGISTRY
        1. 35.3.1. Native Visual Basic Registry Methods
        2. 35.3.2. My.Computer.Registry
      4. 35.4. CONFIGURATION FILES
      5. 35.5. RESOURCE FILES
        1. 35.5.1. Application Resources
        2. 35.5.2. Using Application Resources
        3. 35.5.3. Embedded Resources
        4. 35.5.4. Satellite Resources
        5. 35.5.5. Localization Resources
        6. 35.5.6. ComponentResourceManager
      6. 35.6. APPLICATION
        1. 35.6.1. Application Properties
        2. 35.6.2. Application Methods
        3. 35.6.3. Application Events
      7. 35.7. SUMMARY
    2. 36. Streams
      1. 36.1. STREAM
      2. 36.2. FILESTREAM
      3. 36.3. MEMORYSTREAM
      4. 36.4. BUFFEREDSTREAM
      5. 36.5. BINARYREADER AND BINARYWRITER
      6. 36.6. TEXTREADER AND TEXTWRITER
      7. 36.7. STRINGREADER AND STRINGWRITER
      8. 36.8. STREAMREADER AND STREAMWRITER
      9. 36.9. OPENTEXT, CREATETEXT, AND APPENDTEXT
      10. 36.10. CUSTOM STREAM CLASSES
      11. 36.11. SUMMARY
    3. 37. File-System Objects
      1. 37.1. PERMISSIONS
      2. 37.2. VISUAL BASIC METHODS
        1. 37.2.1. File Methods
        2. 37.2.2. File-System Methods
        3. 37.2.3. Sequential-File Access
        4. 37.2.4. Random-File Access
        5. 37.2.5. Binary-File Access
      3. 37.3. .NET FRAMEWORK CLASSES
        1. 37.3.1. Directory
        2. 37.3.2. File
        3. 37.3.3. DriveInfo
        4. 37.3.4. DirectoryInfo
        5. 37.3.5. FileInfo
        6. 37.3.6. FileSystemInfo
        7. 37.3.7. FileSystemWatcher
        8. 37.3.8. Path
      4. 37.4. MY.COMPUTER.FILESYSTEM
      5. 37.5. MY.COMPUTER.FILESYSTEM.SPECIALDIRECTORIES
      6. 37.6. SUMMARY
    4. 38. Windows Communication Foundation
      1. 38.1. WCF CONCEPTS
      2. 38.2. WCF EXAMPLE
      3. 38.3. BUILDING THE INITIAL SERVICE
      4. 38.4. BUILDING QUOTESERVICE
      5. 38.5. TESTING QUOTESERVICE
      6. 38.6. BUILDING QUOTECLIENT
      7. 38.7. SUMMARY
    5. 39. Useful Namespaces
      1. 39.1. ROOT NAMESPACES
        1. 39.1.1. The Microsoft Namespace
        2. 39.1.2. The System Namespace
      2. 39.2. ADVANCED EXAMPLES
        1. 39.2.1. Regular Expressions
      3. 39.3. XML
        1. 39.3.1. Cryptography
        2. 39.3.2. Reflection
      4. 39.4. TPL
        1. 39.4.1. Getting Started
        2. 39.4.2. Parallel.Invoke
        3. 39.4.3. Parallel.For
        4. 39.4.4. Parallel.ForEach
      5. 39.5. SUMMARY
  11. VI. Appendices
    1. A. Useful Control Properties, Methods, and Events
      1. A.1. PROPERTIES
      2. A.2. METHODS
      3. A.3. EVENTS
      4. A.4. EVENT SEQUENCES
        1. A.4.1. Mouse Events
        2. A.4.2. Resize Events
        3. A.4.3. Move Events
    2. B. Variable Declarations and Data Types
      1. B.1. VARIABLE DECLARATIONS
      2. B.2. INITIALIZATION EXPRESSIONS
      3. B.3. WITH
      4. B.4. FROM
      5. B.5. USING
      6. B.6. ENUMERATED TYPE DECLARATIONS
      7. B.7. XML VARIABLES
      8. B.8. OPTION EXPLICIT AND OPTION STRICT
      9. B.9. OPTION INFER
      10. B.10. DATA TYPES
      11. B.11. DATA TYPE CHARACTERS
      12. B.12. LITERAL TYPE CHARACTERS
      13. B.13. DATA TYPE CONVERSION FUNCTIONS
      14. B.14. CTYPE AND DIRECTCAST
    3. C. Operators
      1. C.1. ARITHMETIC OPERATORS
      2. C.2. CONCATENATION OPERATORS
      3. C.3. COMPARISON OPERATORS
      4. C.4. LOGICAL OPERATORS
      5. C.5. BITWISE OPERATORS
      6. C.6. OPERATOR PRECEDENCE
      7. C.7. ASSIGNMENT OPERATORS
      8. C.8. CHOOSE, IF, AND IIF
      9. C.9. DATE AND TIMESPAN OPERATORS
      10. C.10. OPERATOR OVERLOADING
    4. D. Subroutine and Function Declarations
      1. D.1. SUBROUTINES
      2. D.2. FUNCTIONS
      3. D.3. PROPERTY PROCEDURES
      4. D.4. LAMBDA FUNCTIONS AND EXPRESSIONS
      5. D.5. EXTENSION METHODS
      6. D.6. PARTIAL METHODS
    5. E. Control Statements
      1. E.1. DECISION STATEMENTS
        1. E.1.1. Single-Line If Then
        2. E.1.2. Multiline If Then
        3. E.1.3. Select Case
        4. E.1.4. If and IIf
        5. E.1.5. Choose
      2. E.2. LOOPING STATEMENTS
        1. E.2.1. For Next
        2. E.2.2. For Each
        3. E.2.3. Do Loop
        4. E.2.4. While End
      3. E.3. GOTO
    6. F. Error Handling
      1. F.1. STRUCTURED ERROR HANDLING
      2. F.2. THROWING EXCEPTIONS
      3. F.3. CLASSIC ERROR HANDLING
    7. G. Windows Forms Controls and Components
      1. G.1. COMPONENTS' PURPOSES
      2. G.2. POINTER
      3. G.3. BACKGROUNDWORKER
      4. G.4. BINDINGNAVIGATOR
      5. G.5. BINDINGSOURCE
      6. G.6. BUTTON
      7. G.7. CHECKBOX
      8. G.8. CHECKEDLISTBOX
      9. G.9. COLORDIALOG
      10. G.10. COMBOBOX
      11. G.11. CONTEXTMENUSTRIP
      12. G.12. DATAGRIDVIEW
      13. G.13. DATASET
      14. G.14. DATETIMEPICKER
      15. G.15. DIRECTORYENTRY
      16. G.16. DIRECTORYSEARCHER
      17. G.17. DOMAINUPDOWN
      18. G.18. ERRORPROVIDER
      19. G.19. EVENTLOG
      20. G.20. FILESYSTEMWATCHER
      21. G.21. FLOWLAYOUTPANEL
      22. G.22. FOLDERBROWSERDIALOG
      23. G.23. FONTDIALOG
      24. G.24. GROUPBOX
      25. G.25. HELPPROVIDER
      26. G.26. HSCROLLBAR
      27. G.27. IMAGELIST
      28. G.28. LABEL
      29. G.29. LINKLABEL
      30. G.30. LISTBOX
      31. G.31. LISTVIEW
        1. G.31.1. ListView Helper Code
        2. G.31.2. Custom ListView Sorting
      32. G.32. MASKEDTEXTBOX
      33. G.33. MENUSTRIP
      34. G.34. MESSAGEQUEUE
      35. G.35. MONTHCALENDAR
      36. G.36. NOTIFYICON
      37. G.37. NUMERICUPDOWN
      38. G.38. OPENFILEDIALOG
      39. G.39. PAGESETUPDIALOG
      40. G.40. PANEL
      41. G.41. PERFORMANCECOUNTER
      42. G.42. PICTUREBOX
      43. G.43. PRINTDIALOG
      44. G.44. PRINTDOCUMENT
      45. G.45. PRINTPREVIEWCONTROL
      46. G.46. PRINTPREVIEWDIALOG
      47. G.47. PROCESS
      48. G.48. PROGRESSBAR
      49. G.49. PROPERTYGRID
      50. G.50. RADIOBUTTON
      51. G.51. RICHTEXTBOX
      52. G.52. SAVEFILEDIALOG
      53. G.53. SERIALPORT
      54. G.54. SERVICECONTROLLER
      55. G.55. SPLITCONTAINER
      56. G.56. SPLITTER
      57. G.57. STATUSSTRIP
      58. G.58. TABCONTROL
      59. G.59. TABLELAYOUTPANEL
      60. G.60. TEXTBOX
      61. G.61. TIMER
      62. G.62. TOOLSTRIP
      63. G.63. TOOLSTRIPCONTAINER
      64. G.64. TOOLTIP
      65. G.65. TRACKBAR
      66. G.66. TREEVIEW
      67. G.67. VSCROLLBAR
      68. G.68. WEBBROWSER
    8. H. WPF Controls
    9. I. Visual Basic Power Packs
      1. I.1. MICROSOFT POWER PACKS
        1. I.1.1. DataRepeater
        2. I.1.2. Line and Shape Controls
        3. I.1.3. Printer Compatibility Library
        4. I.1.4. PrintForm Component
      2. I.2. GOTDOTNET POWER PACK
      3. I.3. POWER TOYS PACK INSTALLER
      4. I.4. REFACTOR!
    10. J. Form Objects
      1. J.1. PROPERTIES
      2. J.2. METHODS
      3. J.3. EVENTS
      4. J.4. PROPERTY-CHANGED EVENTS
    11. K. Classes and Structures
      1. K.1. CLASSES
      2. K.2. STRUCTURES
      3. K.3. CONSTRUCTORS
      4. K.4. EVENTS
    12. L. LINQ
      1. L.1. BASIC LINQ QUERY SYNTAX
        1. L.1.1. From
        2. L.1.2. Where
        3. L.1.3. Order By
        4. L.1.4. Select
        5. L.1.5. Distinct
        6. L.1.6. Join
        7. L.1.7. Group By
        8. L.1.8. Limiting Results
      2. L.2. USING QUERY RESULTS
      3. L.3. LINQ FUNCTIONS
      4. L.4. LINQ TO XML
        1. L.4.1. LINQ Into XML
        2. L.4.2. LINQ Out Of XML
      5. L.5. LINQ TO DATASET
        1. L.5.1. Method-Based Queries
      6. L.6. PLINQ
    13. M. Generics
      1. M.1. GENERIC CLASSES
      2. M.2. GENERIC EXTENSIONS
      3. M.3. GENERIC METHODS
      4. M.4. PROHIBITED GENERICS
    14. N. Graphics
      1. N.1. GRAPHICS NAMESPACES
        1. N.1.1. System.Drawing
        2. N.1.2. System.Drawing.Drawing2D
        3. N.1.3. System.Drawing.Imaging
        4. N.1.4. System.Drawing.Printing
        5. N.1.5. System.Drawing.Text
      2. N.2. DRAWING CLASSES
        1. N.2.1. Graphics
        2. N.2.2. Pen
        3. N.2.3. Brushes
        4. N.2.4. GraphicsPath
        5. N.2.5. StringFormat
        6. N.2.6. Image
        7. N.2.7. Bitmap
        8. N.2.8. Metafile
    15. O. Useful Exception Classes
      1. O.1. STANDARD EXCEPTION CLASSES
      2. O.2. CUSTOM EXCEPTION CLASSES
    16. P. Date and Time Format Specifiers
      1. P.1. STANDARD FORMAT SPECIFIERS
      2. P.2. CUSTOM FORMAT SPECIFIERS
    17. Q. Other Format Specifiers
      1. Q.1. STANDARD NUMERIC FORMAT SPECIFIERS
      2. Q.2. CUSTOM NUMERIC FORMAT SPECIFIERS
      3. Q.3. NUMERIC FORMATTING SECTIONS
      4. Q.4. COMPOSITE FORMATTING
      5. Q.5. ENUMERATED TYPE FORMATTING
    18. R. The Application Class
      1. R.1. PROPERTIES
      2. R.2. METHODS
      3. R.3. EVENTS
    19. S. The My Namespace
      1. S.1. MY.APPLICATION
      2. S.2. MY.COMPUTER
        1. S.2.1. Audio
        2. S.2.2. Clipboard
        3. S.2.3. Clock
        4. S.2.4. FileSystem
        5. S.2.5. Info
        6. S.2.6. Keyboard
        7. S.2.7. Mouse
        8. S.2.8. Name
        9. S.2.9. Network
        10. S.2.10. Ports
        11. S.2.11. Registry
        12. S.2.12. Screen
      3. S.3. MY.FORMS
      4. S.4. MY.RESOURCES
      5. S.5. MY.USER
    20. T. Streams
      1. T.1. STREAM CLASS SUMMARY
      2. T.2. STREAM
      3. T.3. BINARYREADER AND BINARYWRITER
      4. T.4. TEXTREADER AND TEXTWRITER
      5. T.5. STRINGREADER AND STRINGWRITER
      6. T.6. STREAMREADER AND STREAMWRITER
      7. T.7. TEXT FILE STREAM METHODS
    21. U. File-System Classes
      1. U.1. VISUAL BASIC METHODS
      2. U.2. FRAMEWORK CLASSES
        1. U.2.1. FileSystem
        2. U.2.2. Directory
        3. U.2.3. File
        4. U.2.4. DriveInfo
        5. U.2.5. DirectoryInfo
        6. U.2.6. FileInfo
        7. U.2.7. FileSystemWatcher
        8. U.2.8. Path
      3. U.3. MY.COMPUTER.FILESYSTEM
      4. U.4. MY.COMPUTER.FILESYSTEM.SPECIALDIRECTORIES
    22. V. Index of Examples