You are previewing Visual Basic® 2012 How to Program, Sixth Edition.
O'Reilly logo
Visual Basic® 2012 How to Program, Sixth Edition

Book Description

Appropriate for all basic-to-intermediate level courses in Visual Basic 2012 programming. Visual Basic 2012 How to Program, Sixth Edition is also appropriate for anyone interested in learning programming with Visual Basic 2012.

Created by world-renowned programming instructors Paul and Harvey Deitel, Visual Basic 2012 How to Program, Sixth Edition introduces all facets of the Visual Basic 2012 language through a hands-on approach with hundreds of working programs. This book has been thoroughly updated to reflect the major innovations Microsoft has incorporated in Visual Basic 2012; all discussions and sample code have been carefully audited against the newest Visual Basic language specification. The Sixth Edition is updated to Visual Studio 2012 and includes new chapters on Windows 8 UI app development, Windows 8 graphics/multimedia, Windows Phone 8 app development and Windows Azure.

Readers begin by getting comfortable with the free Visual Basic Express 2012 IDE and basic VB syntax. Next, they build their skills one step at a time, mastering control structures, classes, objects, methods, variables, arrays, and the core techniques of object-oriented programming. With this strong foundation in place, the Deitels introduce more sophisticated techniques, including inheritance, polymorphism, exception handling, strings, GUI's, data structures, generics, and collections. Throughout, the authors show developers how to make the most of Microsoft’s Visual Studio tools. A series of appendices provide essential programming reference material on various topics.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication Page
  4. Trademarks
  5. Brief Contents
  6. Contents
  7. Preface
  8. Before You Begin
  9. 1 Introduction to Computers, the Internet and Visual Basic
    1. 1.1 Introduction
    2. 1.2 Hardware and Moore’s Law
    3. 1.3 Data Hierarchy
    4. 1.4 Computer Organization
    5. 1.5 Machine Languages, Assembly Languages and High-Level Languages
    6. 1.6 Object Technology
    7. 1.7 Internet and World Wide Web
    8. 1.8 Visual Basic
    9. 1.9 Microsoft’s .NET
    10. 1.10 Microsoft’s Windows® Operating System
    11. 1.11 Windows Phone 8 for Smartphones
    12. 1.12 Windows Azure™ and Cloud Computing
    13. 1.13 Visual Studio Integrated Development Environment
    14. 1.14 Test-Driving the Visual Basic Advanced Painter App in Visual Studio 2012
  10. 2 Dive Into® Visual Studio Express 2012 for Windows Desktop
    1. 2.1 Introduction
    2. 2.2 Overview of the Visual Studio 2012 IDE
    3. 2.3 Menu Bar and Toolbar
    4. 2.4 Navigating the Visual Studio IDE
    5. 2.5 Using Help
    6. 2.6 Using Visual App Development to Create a Simple App that Displays Text and an Image
    7. 2.7 Wrap-Up
    8. 2.8 Web Resources
  11. 3 Introduction to Visual Basic Programming
    1. 3.1 Introduction
    2. 3.2 Programmatically Displaying Text in a Label
    3. 3.3 Addition Program
    4. 3.4 Building the Addition Program
    5. 3.5 Memory Concepts
    6. 3.6 Arithmetic
    7. 3.7 Decision Making: Equality and Relational Operators
    8. 3.8 Wrap-Up
  12. 4 Introduction to Problem Solving and Control Statements
    1. 4.1 Introduction
    2. 4.2 Algorithms
    3. 4.3 Pseudocode Algorithm
    4. 4.4 Control Structures
    5. 4.5 If...Then Selection Statement
    6. 4.6 If...Then...Else Selection Statement
    7. 4.7 Nested If...Then...Else Selection Statements
    8. 4.8 Repetition Statements
    9. 4.9 Compound Assignment Operators
    10. 4.10 Formulating Algorithms: Counter-Controlled Repetition
    11. 4.11 Formulating Algorithms: Nested Control Statements
    12. 4.12 Using the Debugger: Locating a Logic Error
    13. 4.13 Wrap-Up
  13. 5 Problem Solving and Control Statements: Part 2
    1. 5.1 Introduction
    2. 5.2 For...Next Repetition Statement
    3. 5.3 Examples Using the For...Next Statement
    4. 5.4 App: Interest Calculator
    5. 5.5 Formulating Algorithms: Nested Repetition Statements
    6. 5.6 Select...Case Multiple-Selection Statement
    7. 5.7 Do...Loop While and Do...Loop Until Repetition Statements
    8. 5.8 Using Exit to Terminate Repetition Statements
    9. 5.9 Using Continue in Repetition Statements
    10. 5.10 Logical Operators
    11. 5.11 App: Dental Payment Calculator
    12. 5.12 Wrap-Up
  14. 6 Methods
    1. 6.1 Introduction
    2. 6.2 Classes and Methods
    3. 6.3 Subroutines: Methods That Do Not Return a Value
    4. 6.4 Functions: Methods That Return a Value
    5. 6.5 Implicit Argument Conversions
    6. 6.6 Option Strict and Data-Type Conversions
    7. 6.7 Passing Arguments: Pass-by-Value vs. Pass-by-Reference
    8. 6.8 Scope of Declarations
    9. 6.9 Case Study: Random-Number Generation
    10. 6.10 Case Study: A Game of Chance
    11. 6.11 Method Overloading
    12. 6.12 Optional Parameters
    13. 6.13 Using the Debugger: Debugging Commands
    14. 6.14 Wrap-Up
  15. 7 Arrays
    1. 7.1 Introduction
    2. 7.2 Arrays
    3. 7.3 Declaring and Allocating Arrays
    4. 7.4 Initializing the Values in an Array
    5. 7.5 Summing the Elements of an Array
    6. 7.6 Using Arrays to Analyze Survey Results
    7. 7.7 Die-Rolling App with an Array of Counters
    8. 7.8 Case Study: Flag Quiz
    9. 7.9 Passing an Array to a Method
    10. 7.10 For Each...Next Repetition Statement
    11. 7.11 Sorting an Array with Method Sort of Class Array
    12. 7.12 Searching an Array with Linear Search
    13. 7.13 Searching a Sorted Array with Array Method BinarySearch
    14. 7.14 Rectangular Arrays
    15. 7.15 Case Study: Maintaining Grades Using a Rectangular Array
    16. 7.16 Resizing an Array with the ReDim Statement
    17. 7.17 Wrap-Up
  16. 8 Files
    1. 8.1 Introduction
    2. 8.2 Data Hierarchy
    3. 8.3 Files and Streams
    4. 8.4 Test-Driving the Credit Inquiry App
    5. 8.5 Writing Data Sequentially to a Text File
    6. 8.6 Building Menus with the Windows Forms Designer
    7. 8.7 Credit Inquiry App: Reading Data Sequentially from a Text File
    8. 8.8 Wrap-Up
  17. 9 Object-Oriented Programming: Classes and Objects
    1. 9.1 Introduction
    2. 9.2 Classes, Objects, Methods and Instance Variables
    3. 9.3 Account Class
    4. 9.4 Value Types and Reference Types
    5. 9.5 Case Study: Card Shuffling and Dealing Simulation
    6. 9.6 Case Study: Time Class
    7. 9.7 Class Scope
    8. 9.8 Object Initializers
    9. 9.9 Auto-Implemented Properties
    10. 9.10 Using Me to Access the Current Object
    11. 9.11 Garbage Collection
    12. 9.12 Shared Class Members
    13. 9.13 Const and ReadOnly Fields
    14. 9.14 Shared Methods and Class Math
    15. 9.15 Object Browser
    16. 9.16 Wrap-Up
  18. 10 Object-Oriented Programming: Inheritance and Polymorphism
    1. 10.1 Introduction
    2. 10.2 Base Classes and Derived Classes
    3. 10.3 Business Case Study: Commission Employees Class Hierarchy
    4. 10.4 Constructors in Derived Classes
    5. 10.5 Protected Members
    6. 10.6 Introduction to Polymorphism: A Polymorphic Video Game
    7. 10.7 Abstract Classes and Methods
    8. 10.8 Case Study: Payroll System Class Hierarchy Using Polymorphism
    9. 10.9 Online Case Study: Interfaces
    10. 10.10 Wrap-Up
  19. 11 Introduction to LINQ
    1. 11.1 Introduction
    2. 11.2 Querying an Array of Primitive-Type Elements Using LINQ
    3. 11.3 Querying an Array of Reference-Type Elements Using LINQ
    4. 11.4 Deferred Execution and Transforming Query Results
    5. 11.5 LINQ Resource Center
    6. 11.6 Wrap-Up
  20. 12 Databases and LINQ
    1. 12.1 Introduction
    2. 12.2 Relational Databases
    3. 12.3 A Books Database
    4. 12.4 LINQ to Entities and the ADO.NET Entity Framework
    5. 12.5 Querying a Database with LINQ
    6. 12.6 Dynamically Binding Query Results
    7. 12.7 Retrieving Data from Multiple Tables with LINQ
    8. 12.8 Creating a Master/Detail View App
    9. 12.9 Address Book Case Study
    10. 12.10 Tools and Web Resources
    11. 12.11 Wrap-Up
  21. 13 Web App Development with ASP.NET
    1. 13.1 Introduction
    2. 13.2 Web Basics
    3. 13.3 Multitier App Architecture
    4. 13.4 Your First Web App
    5. 13.5 Standard Web Controls: Designing a Form
    6. 13.6 Validation Controls
    7. 13.7 Session Tracking
    8. 13.8 Case Study: Database-Driven ASP.NET Guestbook
    9. 13.9 Online Case Study: ASP.NET AJAX
    10. 13.10 Online Case Study: Password-Protected Books Database App
    11. 13.11 Wrap-Up
  22. 14 Windows Forms GUI: A Deeper Look
    1. 14.1 Introduction
    2. 14.2 Controls and Components
    3. 14.3 Creating Event Handlers
    4. 14.4 Control Properties and Layout
    5. 14.5 GroupBoxes and Panels
    6. 14.6 ToolTips
    7. 14.7 Mouse-Event Handling
    8. 14.8 Keyboard-Event Handling
    9. 14.9 Menus
    10. 14.10 MonthCalendar Control
    11. 14.11 DateTimePicker Control
    12. 14.12 LinkLabel Control
    13. 14.13 ListBox and CheckedListBox Controls
    14. 14.14 Multiple Document Interface (MDI) Windows
    15. 14.15 Visual Inheritance
    16. 14.16 Animation with the Timer Component
    17. 14.17 Wrap-Up
  23. 15 Graphics and Multimedia
    1. 15.1 Introduction
    2. 15.2 Drawing Classes and the Coordinate System
    3. 15.3 Graphics Contexts and Graphics Objects
    4. 15.4 Colors
    5. 15.5 Fonts
    6. 15.6 Drawing Lines, Rectangles and Ovals
    7. 15.7 Drawing Arcs
    8. 15.8 Drawing Polygons and Polylines
    9. 15.9 Additional Brush Types
    10. 15.10 Loading, Displaying and Scaling Images
    11. 15.11 Windows Media Player
    12. 15.12 Printing
    13. 15.13 Wrap-Up
  24. Online Chapters
  25. A Operator Precedence Chart
  26. B Primitive Types
  27. C Number Systems
    1. C.1 Introduction
    2. C.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
    3. C.3 Converting Octal and Hexadecimal Numbers to Binary Numbers
    4. C.4 Converting from Binary, Octal or Hexadecimal to Decimal
    5. C.5 Converting from Decimal to Binary, Octal or Hexadecimal
    6. C.6 Negative Binary Numbers: Two’s-Complement Notation
  28. D ASCII Character Set
  29. E Unicode®
    1. E.1 Introduction
    2. E.2 Unicode Transformation Formats
    3. E.3 Characters and Glyphs
    4. E.4 Advantages/Disadvantages of Unicode
    5. E.5 Using Unicode
    6. E.6 Character Ranges
  30. F Creating Console Applications
    1. F.1 Introduction
    2. F.2 A Simple Console Application
    3. F.3 Creating a Console Application
  31. Index