You are previewing Start Here!™ Learn Microsoft Visual Basic® 2012.
O'Reilly logo
Start Here!™ Learn Microsoft Visual Basic® 2012

Book Description

Ready to learn Microsoft Visual Basic? Start Here!

Learn the fundamentals of modern programming with Visual Basic 2012—and begin building your first Windows 8 apps for the desktop. If you have absolutely no previous experience with Visual Basic, no problem—simply start here! This book introduces must-know concepts and techniques through easy-to-follow explanations, examples, and exercises.

Here’s where you start learning Visual Basic

  • Learn the fundamentals of programming with Visual Basic

  • Discover how to to bind controls to data

  • Design and interact with user interfaces built with XAML

  • Build and debug complete applications

  • Learn the basics of Windows 8 application design

  • Find out how to deliver your applications to the Windows Store

  • Table of Contents

    1. Dedication
    2. Special Upgrade Offer
    3. A Note Regarding Supplemental Files
    4. Introduction
      1. Who Should Read This Book
        1. Assumptions
      2. Who Should Not Read This Book
      3. Organization of This Book
      4. Free eBook Reference
      5. Conventions and Features in This Book
      6. System Requirements
      7. Code Samples
        1. Installing the Code Samples
        2. Using the Code Samples
      8. Acknowledgments
      9. Errata & Book Support
      10. We Want to Hear from You
      11. Stay in Touch
    5. 1. Getting to Know Visual Basic 2012
      1. Development Opportunities for Visual Basic Programmers
        1. New Development Platforms
      2. Obtaining, Installing, and Starting Visual Studio Express 2012 for Windows 8
        1. Downloading the Product
        2. Installing Visual Studio Express 2012 for Windows 8
        3. Starting Visual Studio Express 2012
          1. Start Visual Studio Express 2012
      3. The Visual Studio Development Environment
        1. Open a Visual Basic project
          1. Open a Visual Basic project
      4. The Visual Studio Tools
        1. The Designer Window
          1. Display the Designer window
        2. Running a Visual Basic Program
          1. Run the World Capitals program
      5. The Properties Window
        1. Change properties
          1. Change properties
      6. Moving and Resizing the Programming Tools
        1. Moving and Resizing Tool Windows
          1. Move and resize the Properties window
        2. Docking Tool Windows
          1. Dock the Properties window
        3. Hiding Tool Windows
          1. Use the Auto Hide feature
      7. Switching Among Open Files and Tools Using the IDE Navigator
        1. Use the IDE Navigator
          1. Use the IDE Navigator
      8. Opening a Web Browser Within Visual Studio
        1. Open the Visual Studio web browser
          1. Open the Visual Studio web browser
      9. Customizing IDE Settings to Match This Book’s Exercises
        1. Checking Project and Compiler Settings
          1. Check project and compiler settings
      10. Exiting Visual Studio
        1. Exit Visual Studio
          1. Exit Visual Studio
      11. Summary
    6. 2. Creating Your First Windows 8 Application
      1. Web List: Your First Visual Basic Program
      2. Creating the User Interface
        1. Create a new project
          1. Create a new project
          2. Create a user interface
          3. Move and resize a text box
          4. Add a button object
          5. Add a second text box
          6. Add a web view object
      3. Setting the Properties
        1. Set the web address text box
          1. Set the web address text box
          2. Set the Content property of the button object
          3. Set the properties of the web view object
      4. Writing the Visual Basic Code
        1. Use the Code Editor to create an event handler
          1. Use the Code Editor to create an event handler
        2. A Look at the Visual Basic Code-Behind File
      5. Running Visual Basic Applications
        1. Run the My Web List program
          1. Run the My Web List program
        2. Sample Projects on Disk
      6. Building an Executable File and Deploying
        1. Deploy a release build for a Windows 8 application
          1. Deploy a release build for a Windows 8 application
      7. Summary
    7. 3. Using Controls
      1. Using the Ellipse and TextBlock Controls
        1. Create a colorful background shape with the Ellipse control
          1. Create a colorful background shape with the Ellipse control
          2. Add a TextBlock control to display text on the page
      2. Using the CheckBox and RadioButton Controls
        1. Add a check box to the page
          1. Add a check box to the page
          2. Add radio buttons to a page
      3. Using the MediaElement Control to Add Music and Video
        1. Thinking about Media Files
          1. Play audio media with the MediaElement control
          2. Use Button controls to manage playback
          3. Play video media with the MediaElement control
      4. Summary
    8. 4. Designing Windows 8 Applications with Blend for Visual Studio
      1. Blend for Visual Studio
        1. Why Blend Is Useful for Visual Studio Developers
        2. Starting Blend
          1. Open a new project in Blend
        3. Design Tools in the Blend IDE
      2. Using XAML Controls in Blend
        1. Add an Image control to the page
          1. Add an Image control to the page
          2. Add a Button control to the page
      3. Creating a Storyboard to Add Basic Animation Effects
        1. Create a storyboard
          1. Create a storyboard
          2. Run and test a storyboard
      4. Writing Event Handlers in Visual Studio
        1. Adjust Blend settings for XAML projects
          1. Adjust Blend settings for XAML projects
          2. Open and run the event handler
          3. Edit the event handler to reverse the animation
        2. Using the OnNavigatedTo Event
          1. Create a startup event handler for the main page
      5. Summary
    9. 5. Working with XAML
      1. Understanding XAML Basics
        1. What Is XAML?
        2. XAML Is Related to XML and HTML
        3. XAML Elements
          1. Namespaces in XAML Markup
        4. Examining XAML Project Files
          1. Open a new Windows 8 XAML project and examine App.xaml
          2. Edit XAML markup in MainPage.xaml
      2. Creating XAML Objects
        1. Add ToggleButton and Image controls to the grid
          1. Add ToggleButton and Image controls to the grid
          2. Create an event handler for the toggle button object
          3. Add a Canvas control and fill it with shapes
      3. Summary
    10. 6. Visual Basic Language Elements
      1. Understanding Visual Basic Program Statements
      2. Using Variables to Store Information
        1. Setting Aside Space for Variables: The Dim Statement
      3. Using Variables in an Event Handler
        1. Change the value of a variable
          1. Change the value of a variable
      4. Using a Variable to Store and Process Input
        1. Process input using a TextBox control
          1. Process input using a TextBox control
      5. Working with Data Types
        1. Use fundamental data types in code
          1. Use fundamental data types in code
      6. Constants: Variables That Don’t Change
        1. Use a constant in a code-behind file
          1. Use a constant in a code-behind file
      7. Working with Visual Basic Operators
        1. Basic Math: The +, –, *, and / Operators
          1. Work with basic operators
        2. Advanced Operators: \, Mod, ^, and &
          1. Work with advanced operators
      8. Establishing Order of Precedence
        1. Using Parentheses in a Formula
      9. Summary
    11. 7. Controlling Application Design, Layout, and Program Flow
      1. Creating a Tile-Based Layout for Windows Store Apps
        1. Designing Pages for User Input
          1. Build a tile-based layout with XAML markup
          2. Use Select Case to process ListBox selections
      2. Evaluating Specific Conditions Using If…Then…Else Statements
        1. Add an If…Then…Else statement
          1. Add an If…Then…Else statement
        2. Using the Day of the Week in an If…Then…Statement
      3. Controlling Program Flow Using For…Next and For Each…Next Loops
        1. For…Next Loops
          1. Add a For…Next loop
        2. For Each…Next Loops
          1. Add a For Each…Next loop
      4. Writing an Exception Handler to Manage Error Conditions
        1. Add an exception handler
          1. Add an exception handler
      5. Summary
    12. 8. Using the .NET Framework
      1. Programming Resourcefully: Using Class Libraries in the .NET Framework
        1. Object-Oriented Terminology
        2. Using the Object Browser
          1. Use the Object Browser to explore Microsoft.VisualBasic
      2. Using Methods in System.String
        1. Process text with .NET Framework methods
          1. Process text with .NET Framework methods
          2. Search a string for a pattern
      3. Using Methods in System.Math
        1. Use the System.Math class to compute square roots
          1. Use the System.Math class to compute square roots
        2. Working with Random Numbers
          1. Generate a random number
      4. Using Code Snippets to Insert Ready-Made Code
        1. Generate a set of random numbers with a Do…While loop
          1. Generate a set of random numbers with a Do…While loop
      5. Summary
    13. 9. Debugging Applications
      1. Finding and Correcting Errors
      2. Three Types of Errors
      3. Identifying Logic Errors
      4. Debugging 101: Using Debugging Mode
        1. Debug the Debug Test program
          1. Debug the Debug Test program
      5. Tracking Variables by Using a Watch Window
        1. Open a Watch window
          1. Open a Watch window
      6. Visualizers: Debugging Tools That Display Data
        1. Open a text visualizer in the debugger
          1. Open a text visualizer in the debugger
      7. Using the Immediate Window
        1. Use the Immediate window to modify a variable
          1. Use the Immediate window to modify a variable
      8. Removing Breakpoints
        1. Remove a breakpoint
          1. Remove a breakpoint
      9. Summary
    14. 10. Managing Data with Arrays and LINQ
      1. Using Arrays to Store Data
        1. Declaring Arrays
        2. Declaring a Fixed-Size Array
        3. Using an Array
        4. Assigning Initial Values to an Array
          1. Create string arrays in a program
      2. Using Methods in the Array Class
        1. Use the Array.Sort and Array.Reverse methods
          1. Use the Array.Sort and Array.Reverse methods
      3. Introducing LINQ
        1. Understanding LINQ Syntax
          1. Create a LINQ query to extract data from one array
          2. Create a LINQ query to find overlapping elements in two arrays
      4. Working with XML Documents
        1. Using XML Documents in a Visual Basic Project
          1. Create a LINQ query that retrieves XML data from an XML document
      5. Summary
    15. 11. Design Focus: Five Great Features for a Windows 8 Application
      1. Creating a Tile for Your App on the Windows Start Page
        1. Create a tile for the Start page
          1. Create a tile for the Start page
          2. Add a custom Start page tile to a Visual Studio project
      2. Creating a Splash Screen for Your App
        1. Create a splash screen to run at startup
          1. Create a splash screen to run at startup
      3. Settings Permissions and Capabilities for Your Windows 8 App
        1. Set permissions and capabilities for your app
          1. Set permissions and capabilities for your app
      4. Using a Project Template to Showcase Application Content
        1. Use the Grid App template to display product information
          1. Use the Grid App template to display product information
      5. Optimizing Your App for Touch Input and Gestures
        1. Touch Input is Built In
        2. The Tap
        3. The Slide
        4. Zooming and Resizing
        5. Designing for Touch
      6. Summary
    16. 12. Future Development Opportunities and the Windows Store
      1. Preparing for the Windows Store
        1. Exploring the Store’s Features
        2. Pricing and Sales
        3. Getting Ready for Certification and Deployment
        4. Store Requirements Checklist
      2. Future Opportunities and Programming Resources
        1. Web Sites for Visual Basic and Windows 8
        2. Video on the Web
        3. Books About Visual Basic and Visual Studio
          1. Visual Basic Programming
          2. Windows Programming
          3. Database Programming and LINQ
          4. Web Programming with Visual Basic
          5. General Books About Programming and Computer Science
      3. Summary
    17. Index
    18. About the Author
    19. Special Upgrade Offer
    20. Copyright