specifying string length

marclile

Newcomer
Joined
Mar 11, 2003
Messages
7
does anyone know how to do the following in vb.net:

Private Type ID3Tag
Tag As String * 3
Title As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 28
End Type

i know that you make is a structure:

Private Structure ID3Tag
Public Tag As String
Public Title As String
Public Artist As String
Public Album As String
Public Year As String
Public Comment As String
End Structure

but how do you specify the lenth of the properties? thanks...
 
quoted from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconstringlength.asp

In Visual Basic .NET, you cannot declare a string to have a fixed length unless you use the VBFixedStringAttribute Class attribute in the declaration.
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:

Visual Basic:
Dim Name As String 
' ... 
Name = "Name is now 30 characters long" ' Length can be changed later.
 
Back
Top