Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Variables must be explicitly declared

Visual Studio .NET 2003

In Visual Basic 6.0, it was possible to declare a group of variables in a single Dim statement. A common usage was to declare a series of letters as integer values: DefInt A-Z.

In Visual Basic .NET, each variable must be individually declared; the DefBool, DefByte, DefInt, DefLng, DefCur, DefSng, DefDbl, DefDec, DefDate, DefStr, DefObj, and DefVar statements are no longer supported.

During upgrade, any variables declared using these statements are explicitly declared as the correct type as shown in the following example:

' Visual Basic 6.0
DefInt A-C

' After upgrade to Visual Basic .NET
' UPGRADE_NOTE: DefInt A-C statement was removed. Variables were explicitly declared as type Short.
Dim A As Short
Dim B As Short
Dim C As Short

What to do next

  • No further action is necessary. This note was added to make you aware of the syntax change and the changes made to your code.

See Also

Data Type Changes in Visual Basic

© 2015 Microsoft