Visual Basic .NET/Introduction

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Visual Basic .NET is the next generation of Microsoft's popular Visual Basic programming languages. Some programmers refer to the new incarnation as VB 7, but this is incorrect. Visual Basic .NET is actually not backwards-compatible with VB6, meaning that code written in the old version will not compile under VB.NET. In fact, the languages are sufficiently different that many programmers consider them independent.

As a language, Visual Basic.NET has the following traits:

Object-Oriented

Visual Basic 6 included limited support for object-oriented design. Encapsulation was supported with Public and Private data types in Classes, as well as special accessor/mutator pairs called Properties (a feature unique to Visual Basic). Polymorphism received crude support through the Implements keyword, which would require that one class implement all of the methods in another, skeleton class. Inheritance was neglected completely.

As of VB.NET, all of this has changed. As with all .NET languages, VB.NET includes full-blown support for object-oriented concepts, including simple inheritance. Unlike most other OOP languages, everything in VB.NET is an object, including all of the primitives (Short, Integer, Long, String, Boolean, etc.) as well as types, events, and even assemblies. Everything inherits from the Object base class.

Event-Driven

All previous versions of Visual Basic were event-driven, but this feature is heavily enhanced under the .NET framework. Events are no longer recognized because they use a certain naming convention (ObjectName_EventName), but now are declared with a Handles ObjectName.EventName clause. Event handlers can also be declared at runtime using the AddHandler command.

.NET Framework

As the name implies, VB.NET runs on top of Microsoft's .NET framework, meaning the language has full access to all of the supporting classes in the framework. It's also possible to run VB.NET programs on top of Mono, the open-source alternative to .NET, not only under Windows, but even Linux or Mac OSX.

Personal tools
Create a book