You are previewing Microsoft Visual Basic 2013 Step by Step.
O'Reilly logo
Microsoft Visual Basic 2013 Step by Step

Book Description

Your hands-on guide to Visual Basic fundamentals

Expand your expertise—and teach yourself the fundamentals of Microsoft Visual Basic 2013. If you have previous programming experience but are new to Visual Basic 2013, this tutorial delivers the step-by-step guidance and coding exercises you need to master core topics and techniques.

Discover how to:

  • Master essential Visual Basic programming techniques

  • Begin building apps for Windows Store, Windows Phone 8, and ASP.NET

  • Design apps using XAML markup, touch input, and live tiles

  • Tackle advanced language concepts, such as polymorphism

  • Manage data sources including XML documents and web data

  • Create a Windows Phone 8 app that manages key lifecycle events

  • Table of Contents

    1. Microsoft Visual Basic 2013 Step by Step
    2. A Note Regarding Supplemental Files
    3. Introduction
      1. Who should read this book
        1. Assumptions
      2. Who should not read this book
      3. Organization of this book
        1. Finding your best starting point in this book
      4. Conventions and features in this book
      5. System requirements
      6. Code samples
        1. Installing the code samples
        2. Using the code samples
      7. Acknowledgments
      8. Errata & book support
      9. We want to hear from you
      10. Stay in touch
    4. I. Introduction to Visual Studio development
      1. 1. Visual Basic 2013 development opportunities and the Windows Store
        1. Visual Basic 2013 products and opportunities
          1. An impressive range of development opportunities and platforms
          2. Taking a multiplatform approach to learning Visual Basic
        2. Evaluating the Windows Store
          1. What is the Windows Store?
          2. Accessing the Windows Store
          3. Sales information and price tiers
          4. Or your application could be free…
          5. Planning ahead for certification
          6. Windows Store requirements checklist
          7. It’s all in the details
        3. Summary
      2. 2. The Visual Studio Integrated Development Environment
        1. Getting started
        2. The Visual Studio development environment
        3. Important tools in the IDE
          1. Organizing tools in the IDE
          2. The Designer and XAML markup
          3. Running and testing Windows Store apps
        4. Working with the Properties window
        5. Organizing the programming tools
          1. Moving and docking tools
            1. Autohide
            2. Tabbed documents, manual docking, and docking guides
          2. Hiding tool windows
        6. Configuring the IDE for step-by-step exercises
        7. Exiting Visual Studio
        8. Summary
      3. 3. Creating your first Windows Store application
        1. Lucky Seven: A Visual Basic app for the Windows Store
        2. Programming step by step
        3. Designing the user interface
        4. Final property settings and adjustments
        5. Writing the code
        6. A look at the SpinButton_Click event handler
        7. Running Windows Store apps
        8. Creating a splash screen for your app
        9. Building an executable file
        10. Summary
      4. 4. Windows desktop apps: A walkthrough using Windows Forms
        1. Inside Windows desktop apps
        2. Visual Basic and Windows desktop apps
        3. Creating a Windows desktop app
        4. Setting properties
          1. The picture box properties
          2. Naming objects for clarity
        5. Writing the code
        6. Behind the scenes in the SpinButton_Click event handler
        7. Running the Lucky Seven desktop app
        8. Building an executable file
        9. Publishing a Windows desktop app
        10. Summary
    5. II. Designing the user interface
      1. 5. Working with Windows Store app controls
        1. Understanding Windows Store app controls
          1. Roots in Windows Presentation Foundation and XAML
          2. Designing for Windows 8.1
        2. Using the TextBox control to receive input
          1. Assigning TextBox contents to a variable
          2. Multiline TextBox controls
          3. Check spelling in a TextBox control
        3. Using the FlipView control to display a series of images
        4. Using the MediaElement control to play entertainment media
        5. Use the WebView control to display live web content
        6. Summary
      2. 6. Working with Windows Forms controls
        1. Using the DateTimePicker control
        2. Controls for gathering input
          1. Using the CheckBox control
          2. Using group boxes and radio buttons
          3. Processing input with list boxes
        3. Adding menus by using the MenuStrip control
          1. Menu features
          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 handlers that manage common dialog boxes
        7. Summary
      3. 7. XAML markup step by step
        1. Introduction to XAML
          1. XAML in the Visual Studio IDE
          2. XAML in Blend for Visual Studio
          3. XAML elements
          4. Namespaces in XAML markup
          5. Examining XAML project files
        2. Adding XAML elements using the Code Editor
        3. Summary
      4. 8. Using XAML styles
        1. Introduction to XAML styles
          1. Where did StandardStyles.xaml go?
          2. Creating new XAML styles
          3. Considering the scope of a style
          4. Sample markup for a new XAML style
          5. Referencing a style
          6. Using explicit and implicit styles
        2. Practicing XAML styles
        3. Building new styles from existing styles
        4. IDE shortcuts for applying styles
        5. Summary
      5. 9. Exploring Windows 8.1 design features: Command bar, flyout, tiles, and touch
        1. Creating a command bar to manage common tasks
          1. Command bar features
          2. Designing your command bar
          3. Command bar practice step by step
        2. Using the Flyout control to collect input and display information
        3. Designing custom tiles for your app
          1. The Assets folder
          2. Required tiles and uses
          3. Programming live tiles
        4. Planning for touch input
          1. XAML controls handle touch automatically
          2. Common gestures
          3. Usability considerations
        5. Security and permissions settings
        6. Summary
      6. 10. Creating console applications
        1. Console applications in Visual Studio
          1. Creating a console application
          2. Modules and procedures
          3. The Sub Main() procedure
        2. Interactive math games
          1. Find the number
          2. Simulating dice
        3. Building, publishing, and running console apps
        4. Summary
    6. III. Visual Basic programming techniques
      1. 11. Mastering data types, operators, and string processing
        1. Strategies for declaring variables and constants
          1. The Dim statement
            1. Explicit variable declaration
            2. Implicit variable declaration
          2. Defining constants
            1. Scope for variables and constants
          3. Guidelines for naming variables and constants
        2. Data types and the ListBox control
        3. Operators and formulas
          1. Arithmetic operators
          2. Advanced arithmetic operators
          3. Shortcut operators
          4. How Visual Basic calculates formulas
        4. Converting data types
          1. The ToString method
          2. The Parse method
          3. The Convert class
          4. Older type conversion functions and their uses
        5. Processing strings with the String class
          1. Common tasks
          2. Sorting text
          3. Working with ASCII codes
          4. Sorting strings in a text box
          5. Examining the Sort Text program code
        6. Protecting text with basic encryption
          1. Using the Xor operator
          2. Examining the encryption program code
        7. Summary
      2. 12. Creative decision structures and loops
        1. Event-driven programming
          1. Using conditional expressions
        2. 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
        3. Mastering Select Case decision structures
          1. Using comparison operators with a Select Case structure
        4. Mastering For…Next loops
          1. Using a loop to fill a TextBox with string data
        5. Complex For…Next loops
          1. The Exit For statement
        6. Writing Do loops
          1. Avoiding an endless loop
          2. Converting temperatures
          3. Using the Until keyword in Do loops
        7. Summary
      3. 13. 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 name and drive errors
          4. Windows Store apps and built-in exception handling
        2. Writing a flash drive error handler
        3. Using the Finally clause to perform cleanup tasks
        4. More complex Try…Catch error handlers
          1. The Exception object
          2. Specifying a retry period
          3. Using nested Try…Catch blocks
        5. Comparing error handlers with defensive programming techniques
        6. The Exit Try statement
        7. Summary
      4. 14. Using arrays, collections, and generics to manage data
        1. Working with arrays of variables
          1. Creating an array
          2. Declaring an array with set elements
          3. Setting aside memory
          4. Working with array elements
          5. Declaring an array and assigning initial values
          6. Creating an array to hold temperatures
          7. The GetUpperBound and GetLowerBound methods
        2. Setting an array’s size at runtime
        3. Preserving array contents by using ReDim Preserve
          1. Using ReDim for three-dimensional arrays
        4. Processing large arrays by using methods in the Array class
          1. The Array class
          2. Get your sort on
        5. Working with collections
          1. Creating collections and generic lists
          2. Declaring generic collections
          3. Sample app with generic list and background image
        6. Summary
      5. 15. Innovative data management with LINQ
        1. LINQ tools and techniques
          1. Fundamental query syntax
        2. Extracting information from arrays
        3. Using LINQ with collections
        4. Using LINQ with XML documents
        5. Summary
      6. 16. Object-oriented programming techniques
        1. Inheriting a form by using the Inheritance Picker
        2. Creating your own base classes
          1. Adding a new class to your project
        3. Inheriting a base class
        4. Polymorphism
          1. Syntax for overriding methods and properties
          2. Referring to the base class with MyBase
          3. Experimenting with polymorphism
        5. Summary
    7. IV. Database and web programming
      1. 17. Database controls for Windows desktop apps
        1. Database programming with ADO.NET
          1. Database terminology
          2. Working with an Access database
          3. The Data Sources window
        2. Using toolbox controls to display database information
        3. SQL statements and filtering data
        4. Summary
      2. 18. Data access for Windows Store apps
        1. Data binding in XAML
          1. A variety of data sources
          2. Binding elements
          3. Binding a control to a class
          4. Using a collection as a source of data
        2. Accessing data in XML documents
          1. Reading an XML file
          2. Searching for items in an XML file
          3. Writing to an XML file
          4. A user interface for data entry
        3. Summary
      3. 19. Visual Studio web development with ASP.NET
        1. Inside ASP.NET
          1. Web Forms
          2. ASP.NET MVC
          3. Web Pages (with Razor)
          4. HTML5 and JavaScript
        2. Building a Web Forms website with ASP.NET
          1. Software requirements for ASP.NET development
          2. Essential steps
          3. Webpages vs. Windows Forms
            1. Server controls
            2. HTML controls
        3. Using the Web Designer
        4. Adding server controls to a website
        5. Writing event handlers for webpage controls
        6. Customizing the website template
        7. Displaying database records on a webpage
        8. Editing document and site master properties
        9. Summary
    8. V. Microsoft Windows Phone programming
      1. 20. Introduction to Windows Phone 8 development
        1. Opportunities in the Windows Phone 8 platform
          1. Key Windows Phone 8 features
          2. Hardware requirements
          3. Integration and collaboration
        2. The Windows Phone Store
          1. What is the Windows Phone Store?
          2. Accessing the Windows Phone Store
          3. How much money do developers make?
          4. Planning ahead for certification
        3. Working with Windows Phone SDK 8.0
          1. Downloading the SDK
        4. Comparing Windows Phone 8 and Windows Store platforms
          1. Differences
          2. Similarities
        5. Summary
      2. 21. Creating your first Windows Phone 8 application
        1. Creating a Windows Phone project
        2. Designing the Golf Caddy user interface
        3. Writing the code
        4. Testing Windows Phone apps
        5. Application life cycle considerations
          1. Closing or deactivating?
          2. The PhoneApplicationSerivce class
          3. Life cycle management with the IsolatedStorageSettings class
        6. Setting options in the Window Phone manifest file
        7. Summary
    9. A. About the author
    10. Index
    11. About the Author
    12. Copyright