Variable Declarations

Variable declarations have undergone some changes that will make them more convenient to use in VB .NET.

In VB6 you couldn't declare multiple variables of a specific type. If you declared a list of variables in VB6, all variables except the last variable in the list were variants. VB6 didn't support variable declaration and initialization in the same statement either. Each of the subsections describes the different styles of VB .NET variable declaration. The comparisons to the old style are included to help you find your bearings.

Declaring and Initializing a Single Variable

VB6 required that you declare and initialize a variable in two separate statements (assuming that Option Explicit was On). VB .NET supports doing both ...

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.