Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Visual Basic 2008 updates string length declaration for interoperability with the common language runtime.
In Visual Basic 6.0, you can specify the length of a string in its declaration. This causes the string to have a fixed length, as in the following example:
Dim Name As String * 30
In Visual Basic 2008, you cannot declare a string to have a fixed length unless you use the VBFixedStringAttribute Class attribute in the declaration. The code in the preceding example causes an error.
You declare a string without a length. When your code assigns a value to the string, the length of the value determines the length of the string, as in the following example:
Dim Name AsString' ...
Name = "Name is now 30 characters long" ' Length can be changed later.
Attributes Used in Visual Basic
Programming Element Support Changes Summary