VB.NET has removed support for several programming elements because the underlying .NET Framework Class Library and the Common Language Runtime (CLR) contain equivalent functionality. Here are the victims and their replacements. (We discuss the class library and CLR in Chapter 4 and Chapter 5.)
The Microsoft.VisualBasic.Constants class
in the Base Class Library defines a number of constants, such as the
vbCrLf constant, so these can be used as
always. However, some constants, such as the color constants
vbBlue, are no longer
directly supported. Indeed, the color constants are part of the
structure, so they are accessed as follows:
Me.BackColor = System.Drawing.Color.BlanchedAlmond
In most cases, to access a particular constant that is not a field in
the Microsoft. VisualBasic.Constants class, you must designate the
enumeration (or structure) to which it belongs, along with the
constant name. For example, the
vbYes constant in
VB 6 continues to exist as an intrinsic constant in VB.NET. However,
it has a counterpart in the
enumeration, which can be accessed as follows:
If MsgBoxResult.Yes = MsgBox("OK to proceed?", ...
For a list of all built-in constants and enums, see Appendix D.
String function has been removed from the
language. In its place, we simply declare a string and initialize it,
using syntax such as:
Dim str As New String("A"c, 5)
which will define ...