This documentation is archived and is not being maintained.

Objects in Visual Basic

Visual Studio 2008

When you create an application in Visual Basic, you constantly work with objects. You can use objects provided by Visual Basic, such as controls, forms, and data access objects. You can also use objects from other applications within your Visual Basic application. You can even create your own objects and define additional properties and methods for them. Objects act like prefabricated building blocks for programs — they let you write a piece of code once and reuse it over and over.

The following topics discuss objects in more detail.

Objects and Classes

Provides an overview of objects and classes.

How to: Create an Object

Explains how to create an object so you can use its members.

How to: Reuse a Working Component

Describes how to use functionality that has already been written and debugged.

How to: Define a Class That Uses Members of an Existing Class

Shows how to use properties and methods of a base class in your derived class.

Relationships Among Objects

Discusses object hierarchies, containers, and collections.

Object Members

Summarizes the fields, properties, methods, and events exposed by objects.

How to: Access Shared and Nonshared Members of an Object

Explains how to read, write, or call a member of an object that you have created.

Anonymous Types

Describes how to create and use anonymous types, which allow you to create objects without writing a class definition for the data type.

Object Initializers: Named and Anonymous Types

Discusses object initializers, which are used to create instances of named and anonymous types by using a single expression.

How to: Infer Property Names and Types in Anonymous Type Declarations

Explains how to infer property names and types in anonymous type declarations. Provides examples of successful inference and inference failures.

Introduction to Objects in Visual Basic

Provides an overview of how objects are used in Visual Basic.

Creating and Using Objects

Shows how to create and use instances of classes.