Microsoft® Visual Basic® 2005 Step by Step, 3rd Edition

Book description

Visual Basic 2005 focuses on enabling developers to rapidly build applications, with enhancements across its visual designers, code editor, language, and debugger that help accelerate the development and deployment of robust, elegant applications across the Web, a business group, or an enterprise. Now you can teach yourself the essentials of working with Microsoft Visual Studio® 2005 and the new features of the Visual Basic language—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 2005. Each chapter puts you to work, showing you how, when, and why to use specific features of Visual Basic and guiding as you create actual components and working applications for Microsoft Windows®. You’ll also explore data management and Web-based development topics.

Table of contents

  1. Microsoft® Visual Basic® 2005 Step by Step
  2. A Note Regarding Supplemental Files
  3. Acknowledgments
  4. Introduction
    1. What is Visual Basic 2005?
      1. Visual Basic .NET Versions
    2. Finding Your Best Starting Point in This Book
    3. 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
      3. Upgrading Visual Basic 6 Programs
    8. Helpful Support Links
      1. Visual Studio 2005 Software Support
      2. Online Companion Content
      3. Microsoft Press Web Site
    9. Support for this Book
      1. Questions and Comments
  5. 1. Getting Started with Microsoft Visual Basic 2005
    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. Opening a Web Browser Within Visual Studio
      6. Getting Help
        1. Two Sources for Help: Local Help Files and Online Content
        2. Summary of Help Commands
      7. Customizing IDE Settings to Match Step-by-Step Exercises
        1. Setting the IDE for Visual Basic Development
        2. Checking Project and Compiler Settings
      8. One Step Further: Exiting Visual Studio
      9. Chapter 1 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
        1. The Picture Box Properties
      5. Writing the Code
        1. A Look at the Button1_Click Procedure
      6. Running Visual Basic Applications
        1. Sample Projects on Disk
      7. Building an Executable File
        1. Deploying Your Application
      8. One Step Further: Adding to a Program
      9. Chapter 2 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
          1. 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. Chapter 3 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. Chapter 4 Quick Reference
  6. 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
      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. Chapter 5 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. Chapter 6 Quick Reference
    3. 7. Using Loops and Timers
      1. Writing For...Next Loops
        1. Displaying a Counter Variable in a TextBox Control
        2. Creating Complex For...Next Loops
        3. Opening Files by Using a Counter That Has Greater Scope
      2. Writing Do Loops
        1. Avoiding an Endless Loop
      3. The Timer Control
        1. Creating a Digital Clock by Using a Timer Control
      4. Using a Timer Object to Set a Time Limit
      5. One Step Further: Inserting Code Snippets
      6. Chapter 7 Quick Reference
    4. 8. Debugging Visual Basic Programs
      1. Finding and Correcting Errors
        1. Three Types of Errors
        2. Identifying Logic Errors
      2. Debugging 101: Using Debugging Mode
      3. Tracking Variables by Using a Watch Window
      4. Visualizers: New Debugging Tools That Display Data
      5. Using the Immediate and Command Windows
        1. Switching to the Command Window
      6. One Step Further: Removing Breakpoints
      7. Chapter 8 Quick Reference
    5. 9. Trapping Errors by Using Structured Error Handling
      1. Processing Errors by Using Try...Catch
        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
        1. Using the Finally Clause to Perform Cleanup Tasks
      3. More Complex Try...Catch Error Handlers
        1. The Err Object
        2. Specifying a Retry Period
        3. Using Nested Try...Catch Blocks
      4. Comparing Error Handlers with Defensive Programming Techniques
      5. One Step Further: The Exit Try Statement
      6. Chapter 9 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. Chapter 10 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
      3. One Step Further: Processing Large Arrays by Using Methods in the Array Class
        1. The Array Class
      4. Chapter 11 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: Visual Basic for Applications Collections
        1. Entering the Sample Code
      4. Chapter 12 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 Object
      3. Creating a New Text File on Disk
      4. Processing Text Strings with Program Code
        1. Processing Strings by Using 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. Chapter 13 Quick Reference
  7. III. Designing the User Interface
    1. 14. Managing Windows Forms and Controls at Run Time
      1. Adding New Forms to a Program
        1. How Forms Are Used
      2. Working with Multiple Forms
      3. Positioning Forms on the Windows Desktop
        1. Minimizing, Maximizing, and Restoring Windows
      4. Adding Controls to a Form at Run Time
      5. Organizing Controls on a Form
      6. One Step Further: Specifying the Startup Object
      7. Chapter 14 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. Chapter 15 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. Chapter 16 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. Chapter 17 Quick Reference
  8. 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
      2. The Data Sources Window
      3. Using Bound Controls to Display Database Information
      4. One Step Further: Writing SQL Statements to Filter Data
      5. Chapter 18 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. Chapter 19 Quick Reference
    3. 20. Creating Web Sites and Web Pages Using Microsoft Visual Web Developer and ASP.NET
      1. Inside ASP.NET 2.0
        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. Chapter 20 Quick Reference
  9. V. Appendix
    1. Where to Go for More Information
      1. Visual Basic Web Sites
        1. www.msdn.microsoft.com/vbasic/
        2. www.devx.com/
        3. www.microsoft.com/learning/books/
        4. www.microsoft.com/learning/training/
        5. www.microsoft.com/communities/
      2. Books for Visual Basic and Visual Studio Programming
        1. Visual Basic 2005 Programming
        2. Visual Studio 2005 and 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
    2. About the Author
  10. Index
  11. About the Author
  12. Copyright

Product information

  • Title: Microsoft® Visual Basic® 2005 Step by Step, 3rd Edition
  • Author(s):
  • Release date: October 2005
  • Publisher(s): Microsoft Press
  • ISBN: 9780735621312