Defining Classes

A Visual Basic .NET class isn't a VB6 class. VB6 classes are declared and defined using the interface keyword in Visual Basic .NET. Classes in Visual Basic .NET are user-defined aggregate types that support inheritance and are distinct from COM interfaces, which is exactly what a VB6 class module is.

All classes in Visual Basic .NET are defined in a .VB file (as opposed to a .CLS file), and a .VB file may contain one or more classes. (Source files can mix and match classes, structures, and modules in the same file.) The basic syntax of a class is as follows:

Class classname
End Class

Tip

If you accidentally mistype the declaration of a class, the Visual Studio .NET IDE will use a squiggly underline to indicate the location ...

Get Visual Basic® .NET Unleashed 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.