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.

Note

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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.