Building a Class

The easiest way to learn is by doing, so let’s create a sample class. This sample class module will define a new type whose purpose is to contain employee information. After setting up the class itself, you will learn how to expose properties, methods, and events to its user.

Starting a New Class Library Project

Begin by creating a new project in Visual Basic .NET. Select Class Library from the list of templates available, and name the project MyClasses. Click OK to create a class library project named MyClasses. Notice that the Solution Explorer window contains a file named Class1.vb; this file will contain the code that defines your new class.


You can include multiple classes in a Class Library project by choosing Project, ...

Get Special Edition Using Microsoft® Visual Basic® .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.