Microsoft® Visual Basic® 2008 Step by Step

Book description

Teach yourself the fundamentals of working with Visual Basic 2008 one step at a time. With STEP BY STEP, you work at your own pace through hands-on, learn-by-doing exercises. Whether you re a beginning programmer or new to this specific language, you ll understand the core capabilities and fundamental techniques for Visual Basic 2008 and rapidly build robust, elegant applications. Each chapter puts you to work, showing you how, when, and why to use the latest features of Visual Basic guiding you each step of the way as you create actual components and working applications for Windows. You ll also explore data management and Web-based development topics. PLUS get practice files with sample code and data sets on the companion CD.
Key Book Benefits
Covers the latest enhancements and features of Visual Basic 2008
Provides step-by-step guidance on how to use Visual Basic 2008 with Microsoft Visual Studio® 2008 to create smart-client and Web applications
Features easy-to-follow, logically planned lessons in the popular STEP BY STEP format ideal for anyone with fundamental programming skills
Includes a companion CD with data sets and code samples

Table of contents

  1. Microsoft Visual Basic 2008 Step by Step
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Acknowledgments
  5. Introduction
    1. What Is Visual Basic 2008?
      1. Visual Basic .NET Versions
      2. Upgrading from Microsoft Visual Basic 6.0
    2. Finding Your Best Starting Point in This Book
    3. Visual Studio 2008 System Requirements
    4. Prerelease Software
    5. Installing and Using the Practice Files
      1. Installing the Practice Files
      2. Using the Practice Files
    6. Uninstalling the Practice Files
    7. Conventions and Features in This Book
      1. Conventions
      2. Other Features
    8. Helpful Support Links
      1. Visual Studio 2008 Software Support
      2. Microsoft Press Web Site
      3. Support for This Book
  6. I. Getting Started with Microsoft Visual Basic 2008
    1. 1. Exploring the Visual Studio Integrated Development Environment
      1. The Visual Studio Development Environment
      2. The Visual Studio Tools
        1. The Designer
        2. Running a Visual Basic Program
      3. The Properties Window
      4. Moving and Resizing the Programming Tools
        1. Moving and Resizing Tool Windows
        2. Docking Tool Windows
        3. Hiding Tool Windows
      5. Switching Among Open Files and Tools by Using the IDE Navigator
      6. Opening a Web Browser Within Visual Studio
      7. Getting Help
        1. Two Sources for Help: Local Help Files and Online Content
        2. Summary of Help Commands
      8. Customizing IDE Settings to Match Step-by-Step Exercises
        1. Setting the IDE for Visual Basic Development
        2. Checking Project and Compiler Settings
      9. One Step Further: Exiting Visual Studio
      10. Quick Reference
    2. 2. Writing Your First Program
      1. Lucky Seven: Your First Visual Basic Program
      2. Programming Steps
      3. Creating the User Interface
      4. Setting the Properties
      5. The Picture Box Properties
      6. Writing the Code
      7. A Look at the Button1_Click Procedure
      8. Running Visual Basic Applications
      9. Sample Projects on Disk
      10. Building an Executable File
      11. Deploying Your Application
      12. One Step Further: Adding to a Program
      13. Quick Reference
    3. 3. Working with Toolbox Controls
      1. The Basic Use of Controls: The Hello World Program
      2. Using the DateTimePicker Control
        1. The Birthday Program
        2. A Word About Terminology
      3. Controls for Gathering Input
        1. The Input Controls Demo
        2. Looking at the Input Controls Program Code
      4. One Step Further: Using the LinkLabel Control
      5. Quick Reference
    4. 4. Working with Menus, Toolbars, and Dialog Boxes
      1. Adding Menus by Using the MenuStrip Control
      2. Adding Access Keys to Menu Commands
      3. Processing Menu Choices
      4. Adding Toolbars with the ToolStrip Control
      5. Using Dialog Box Controls
      6. Event Procedures That Manage Common Dialog Boxes
      7. One Step Further: Assigning Shortcut Keys to Menus
      8. Quick Reference
  7. II. Programming Fundamentals
    1. 5. Visual Basic Variables and Formulas, and the .NET Framework
      1. The Anatomy of a Visual Basic Program Statement
      2. Using Variables to Store Information
        1. Setting Aside Space for Variables: The Dim Statement
        2. Implicit Variable Declaration
      3. Using Variables in a Program
      4. Using a Variable to Store Input
      5. Using a Variable for Output
      6. Working with Specific Data Types
        1. Constants: Variables That Don't Change
      7. Working with Visual Basic Operators
        1. Basic Math: The + , –, * , and / Operators
        2. Using Advanced Operators: \ , Mod, ^, and &
      8. Working with Methods in the Microsoft .NET Framework
      9. One Step Further: Establishing Order of Precedence
        1. Using Parentheses in a Formula
      10. Quick Reference
    2. 6. Using Decision Structures
      1. Event-Driven Programming
      2. Using Conditional Expressions
      3. If…Then Decision Structures
        1. Testing Several Conditions in an If…Then Decision Structure
        2. Using Logical Operators in Conditional Expressions
        3. Short-Circuiting by Using AndAlso and OrElse
      4. Select Case Decision Structures
        1. Using Comparison Operators with a Select Case Structure
      5. One Step Further: Detecting Mouse Events
      6. Quick Reference
    3. 7. Using Loops and Timers
      1. Writing For…Next Loops
      2. Displaying a Counter Variable in a TextBox Control
      3. Creating Complex For…Next Loops
        1. Using a Counter That Has Greater Scope
      4. Writing Do Loops
      5. Avoiding an Endless Loop
      6. The Timer Control
      7. Creating a Digital Clock by Using a Timer Control
      8. Using a Timer Object to Set a Time Limit
      9. One Step Further: Inserting Code Snippets
      10. Quick Reference
    4. 8. Debugging Visual Basic Programs
      1. Finding and Correcting Errors
      2. Three Types of Errors
      3. Identifying Logic Errors
      4. Debugging 101: Using Debugging Mode
      5. Tracking Variables by Using a Watch Window
      6. Visualizers: Debugging Tools That Display Data
      7. Using the Immediate and Command Windows
      8. Switching to the Command Window
      9. One Step Further: Removing Breakpoints
      10. Quick Reference
    5. 9. Trapping Errors by Using Structured Error Handling
      1. Processing Errors by Using the Try…Catch Statement
        1. When to Use Error Handlers
        2. Setting the Trap: The Try…Catch Code Block
        3. Path and Disc Drive Errors
      2. Writing a Disc Drive Error Handler
      3. Using the Finally Clause to Perform Cleanup Tasks
      4. More Complex Try…Catch Error Handlers
        1. The Err Object
        2. Specifying a Retry Period
        3. Using Nested Try…Catch Blocks
      5. Comparing Error Handlers with Defensive Programming Techniques
      6. One Step Further: The Exit Try Statement
      7. Quick Reference
    6. 10. Creating Modules and Procedures
      1. Working with Modules
        1. Creating a Module
      2. Working with Public Variables
      3. Creating Procedures
      4. Writing Function Procedures
        1. Function Syntax
        2. Calling a Function Procedure
        3. Using a Function to Perform a Calculation
      5. Writing Sub Procedures
        1. Sub Procedure Syntax
        2. Calling a Sub Procedure
        3. Using a Sub Procedure to Manage Input
      6. One Step Further: Passing Arguments by Value and by Reference
      7. Quick Reference
    7. 11. Using Arrays to Manage Numeric and String Data
      1. Working with Arrays of Variables
        1. Creating an Array
        2. Declaring a Fixed-Size Array
        3. Setting Aside Memory
        4. Working with Array Elements
        5. Creating a Fixed-Size Array to Hold Temperatures
        6. Creating a Dynamic Array
      2. Preserving Array Contents by Using ReDim Preserve
        1. Three-Dimensional Arrays
      3. One Step Further: Processing Large Arrays by Using Methods in the Array Class
        1. The Array Class
      4. Quick Reference
    8. 12. Working with Collections and the System.Collections Namespace
      1. Working with Object Collections
        1. Referencing Objects in a Collection
        2. Writing For Each…Next Loops
        3. Experimenting with Objects in the Controls Collection
        4. Using the Name Property in a For Each…Next Loop
      2. Creating Your Own Collections
        1. Declaring New Collections
      3. One Step Further: VBA Collections
        1. Entering the Word Macro
      4. Quick Reference
    9. 13. Exploring Text Files and String Processing
      1. Displaying Text Files by Using a Text Box Object
        1. Opening a Text File for Input
        2. The FileOpen Function
      2. Using the StreamReader Class and My.Computer.FileSystem to Open Text Files
        1. The StreamReader Class
        2. The My Namespace
      3. Creating a New Text File on Disk
      4. Processing Text Strings with Program Code
        1. The String Class and Useful Methods and Keywords
        2. Sorting Text
        3. Working with ASCII Codes
        4. Sorting Strings in a Text Box
      5. One Step Further: Examining the Sort Text Program Code
      6. Quick Reference
  8. III. Designing the User Interface
    1. 14. Managing Windows Forms and Controls at Run Time
      1. Adding New Forms to a Program
      2. How Forms Are Used
      3. Working with Multiple Forms
      4. Positioning Forms on the Windows Desktop
        1. Minimizing, Maximizing, and Restoring Windows
      5. Adding Controls to a Form at Run Time
      6. Organizing Controls on a Form
      7. One Step Further: Specifying the Startup Object
      8. Quick Reference
    2. 15. Adding Graphics and Animation Effects
      1. Adding Artwork by Using the System.Drawing Namespace
        1. Using a Form's Coordinate System
        2. The System.Drawing.Graphics Class
        3. Using the Form's Paint Event
      2. Adding Animation to Your Programs
        1. Moving Objects on the Form
        2. The Location Property
        3. Creating Animation by Using a Timer Object
      3. Expanding and Shrinking Objects While a Program Is Running
      4. One Step Further: Changing Form Transparency
      5. Quick Reference
    3. 16. Inheriting Forms and Creating Base Classes
      1. Inheriting a Form by Using the Inheritance Picker
      2. Creating Your Own Base Classes
        1. Adding a New Class to Your Project
      3. One Step Further: Inheriting a Base Class
      4. Quick Reference
    4. 17. Working with Printers
      1. Using the PrintDocument Class
        1. Printing Text from a Text Box Object
      2. Printing Multipage Text Files
      3. One Step Further: Adding Print Preview and Page Setup Dialog Boxes
      4. Quick Reference
  9. IV. Database and Web Programming
    1. 18. Getting Started with ADO.NET
      1. Database Programming with ADO.NET
        1. Database Terminology
        2. Working with an Access Database
        3. The Data Sources Window
      2. Using Bound Controls to Display Database Information
      3. One Step Further: SQL Statements, LINQ, and Filtering Data
      4. Quick Reference
    2. 19. Data Presentation Using the DataGridView Control
      1. Using DataGridView to Display Database Records
      2. Formatting DataGridView Cells
      3. Datacentric Focus:Adding a Second Grid and Navigation Control
      4. One Step Further: Updating the Original Database
      5. Quick Reference
    3. 20. Creating Web Sites and Web Pages by Using Visual Web Developer and ASP.NET
      1. Inside ASP.NET
        1. Web Pages vs. Windows Forms
        2. Server Controls
        3. HTML Controls
      2. Building a Web Site by Using Visual Web Developer
        1. Considering Software Requirements for ASP.NET Programming
      3. Using the Web Page Designer
      4. Adding Server Controls to a Web Site
        1. Writing Event Procedures for Web Page Controls
      5. Adding Additional Web Pages and Resources to a Web Site
      6. Displaying Database Records on a Web Page
      7. One Step Further: Setting the Web Site Title in Internet Explorer
      8. Quick Reference
  10. A. Where to Go for More Information
    1. Visual Basic Web Sites
    2. Books About Visual Basic and Visual Studio Programming
      1. Visual Basic Programming
      2. Microsoft .NET Framework
      3. Database Programming with ADO.NET
      4. Web Programming with ASP.NET
      5. Visual Basic for Applications Programming
      6. General Books about Programming and Computer Science
  11. Index
  12. About the Author
  13. Copyright

Product information

  • Title: Microsoft® Visual Basic® 2008 Step by Step
  • Author(s):
  • Release date: January 2008
  • Publisher(s): Microsoft Press
  • ISBN: 9780735625372