Module 2: Using Visual Basic Programming Constructs
This module introduces many of the basic Visual Basic language data types and programming constructs, and describes the syntax and semantics of these constructs.
- Declaring Variables and Assigning Values
- Using Expressions and Operators
- Creating and Using Arrays
- Using Decision Statements
- Using Iteration Statements
Lab : Using Visual Basic Programming Constructs
Module 3: Declaring and Calling Methods
A key part of developing any application is dividing the solution into logical components. In objectoriented languages such as Microsoft Visual Basic, a method is a unit of code that is designed to perform a discrete piece of work. This module introduces methods and describes how to define and use them.
- Defining and Invoking Methods
- Specifying Optional Parameters and ByRef Parameters
Lab : Declaring and Calling Methods
Module 4: Handling Exceptions
Exception handling is an important concept and your applications should be designed with exception handling in mind. This module explains how you can implement effective exception handling in your applications, and how you can use exceptions in your methods to elegantly indicate an error condition to the code that calls your methods.
- Handling Exceptions
- Raising Exceptions
Lab : Handling Exceptions
Module 5: Reading and Writing Files
The ability to access and manipulate the files on the file system is a common requirement for many applications. This module shows how to read and write to files by using the classes in the Microsoft .NET Framework. This module also describes the different approaches that you can take, and how to read and write different formats of data.
- Accessing the File System
- Reading and Writing Files by Using Streams
Lab : Reading and Writing Files
Module 6: Creating New Types
The Microsoft.NET Framework base class library consists of many types that you can use in your applications. However, in all applications, you must also build your own types that implement the logic for your solution.
This module explains how to create your own modules and types and describes the differences between reference types and value types.
- Creating and Using Modules and Enumerations
- Creating and Using Classes
- Creating and Using Structures
- Comparing References to Values
Lab : Creating New Types
Module 7: Encapsulating Data and Methods
This module describes how to use some of the access modifiers that Visual Basic provides to enable you to implement encapsulation. This module also introduces the Shared modifier, which enables you to define members that can be shared over multiple instances of the same type.
- Controlling Visibility of Type Members
- Sharing Methods and Data
Lab : Encapsulating Data and Methods
Module 8: Inheriting from Classes and Implementing Interfaces
This module introduces inheritance and interfaces in the Microsoft .NET Framework, and how you can use them to simplify complex problems, reduce code duplication, and speed up development. Inheritance is a key concept in an object-oriented language. You can use inheritance, interfaces, and abstract classes to develop object hierarchies in your code. These object hierarchies can help reduce bugs by defining clear contracts for what a class will expose and by providing default implementations where you can sensibly abstract code into a base type.
- Using Inheritance to Define New Reference Types
- Defining and Implementing Interfaces
- Defining Abstract Classes
Lab : Inheriting from Classes and Implementing Interfaces
Module 9: Managing the Lifetime of Objects and Controlling Resources
All applications use resources. When you build a Microsoft Visual Basic application, resources fall into two broad categories: managed resources that are handled by the common language runtime (CLR) and unmanaged resources that are maintained by the operating system outside the scope of the CLR. A managed resource is typically an object based on a class defined by using a managed language, such as Visual Basic. Examples of unmanaged resources include items implemented outside the Microsoft .NET Framework, such as Component Object Model (COM) components, file handles, database connections, and network connections.
Resource management is important in any applications that you develop. The NET Framework simplifies resource management by automatically reclaiming the resources by a managed object when it is no longer referenced by an application. Managed resources are handled by the .NET Framework garbage collector. However, unmanaged resources are not controlled by the garbage collector; you must take special steps to dispose them properly and prevent them from being held longer than necessary.
- Introduction to Garbage Collection
- Managing Resources
Lab : Managing the Lifetime of Objects and Controlling Resources
Module 10: Encapsulating Data and Defining Overloaded Operators
Many operators have well-defined behavior for the built-in Visual Basic types, but you can also define operators for your own types. This module describes how to implement operators for your types by using overloading.
- Creating and Using Properties
- Creating and Using Indexers
- Overloading Operators
Lab : Creating and Using PropertiesLab : Creating and Using Indexers Lab : Overloading Operators
Module 11: Decoupling Methods and Handling Events
This module explains how to decouple an operation from the method that implements it and how to use anonymous methods to implement decoupled operations. This module also explains how to use events to inform consuming applications of a change or notable occurrence in a type.
- Declaring and Using Delegates
- Using Lambda Expressions
- Handling Events
Lab : Decoupling Methods and Handling Events
Module 12: Using Collections and Building Generic Types
The basic collection classes introduce a new problem. Classes that act on other types are often not type-safe. For example, many collection classes frequently use the Object type to store items, and must then be cast or converted back to their original type before they can be used. It is the programmer’s responsibility to ensure that the correct casts or conversions are performed, and it is easy to introduce errors by casting or converting an item to the wrong type. This module introduces generics and how you can use generic classes to maintain type-integrity and avoid issues that are associated with a lack of type safety.
- Using Collections
- Creating and Using Generic Types
- Defining Generic Interfaces and Understanding Variance
- Using Generic Methods and Delegates
Lab : Using CollectionsLab : Building Generic Types
Module 13: Building and Enumerating Custom Collection Classes
When you develop applications, you often need to store collections of objects. In many circumstances, you can use the collection classes that the Microsoft .NET Framework includes; however, sometimes these collection classes do not provide the functionality that you require. For example, you may need to store objects in a sorted order that is based on a custom sorting algorithm.
This module introduces you to custom collection classes. It also explains how you can develop collection classes that support the language constructs that Visual Basic provides, such as enumeration and collection initialization.
- Implementing a Custom Collection Class
- Adding an Enumerator to a Custom Collection Class
Lab : Building and Enumerating Custom Collection Classes
Module 14: Using LINQ to Query Data
This module introduces you to Language-Integrated Query (LINQ) queries and explains how you can use them to process data in your Microsoft .NET Framework applications. This module also explains the difference between shared and dynamic LINQ queries, and describes how you can use dynamic LINQ to create highly flexible queries that you build at run time.
- Using the LINQ Extension Methods and Query Operators
- Building Dynamic LINQ Queries and Expressions
Lab : Using LINQ to Query Data
Module 15: Integrating Visual Basic Code with Dynamic Languages and COM Components
Integration with other technologies is a key feature of the Microsoft.NET Framework. Previous versions of the .NET Framework enabled you to combine components that were developed by using different languages that have compilers that the .NET Framework supports. The .NET Framework 4 now supports integration of components built by using dynamic languages. This enables you to re-use items built by using a wide range of scripting languages that are not easily accessible from Microsoft Visual Basic code.
In addition, previous versions of the .NET Framework have always enabled you to integrate Component Object Model (COM) services and components into your managed applications. The integration did however, require a good understanding of the differences between the way in which the common language runtime (CLR) and the COM environment operated. The new features of Visual Basic 2010 have simplified the way in which you can invoke COM components, so it is easier for you to re-use these items in a Visual Basic application.
This module describes how to integrate code written by using a dynamic language such as Ruby and Python, or technologies such as COM, into a Visual Basic application.
- Integrating Visual Basic Code with Ruby and Python
- Accessing COM Components from Visual Basic
Lab : Integrating Visual Basic Code with Dynamic Languages and COM Components