Object Programming

Unlike previous versions of VB, VB.NET is a fully object-oriented programming language. This object orientation has two aspects: access to the .NET Framework Class Library (FCL), and the ability to define and instantiate custom classes using inheritance.

.NET Framework Class Library

The .NET Framework Class Library is an object-oriented library consisting of thousands of system and application types (classes, structures, interfaces, delegates, and enumerations) organized in namespaces. The namespaces and types of the .NET FCL offer a wide range of functionality, from wrappers to classic Win32 API functions to diagnostics and debugging to input/output to data access, Windows forms programming, and web application and web service development. In fact, most of the “intrinsic” functions and procedures that are part of the VB.NET language are implemented as members of classes in the Microsoft.VisualBasic namespace.

In order to access the types in a namespace, the compiler must be provided with a reference to its assembly. This is done with the /r switch using the VB command line compiler. When a type is instantiated or a type member is invoked, ordinarily the type’s fully qualified namespace must be included. For example, a new instance of an ApplicationException class is generated by the following code fragment:

Dim e As New System.ApplicationException(  )

As an alternative, you can have the compiler or the Visual Studio design-time resolve an unqualified object reference ...

Get VB.NET Language Pocket Reference 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.