By putting [ and ] you can escape the name between them. In this case, since string is a built in keyword in Visual Basic .NET, the compiler would have treated it as the keyword string instead of the type name String.
In this particular case (assuming that you are Importing the System namespace) they just happen to mean the same thing (a string in Visual Basic maps to the System.String class in the .NET framework.
creating a text object
CI2
maybe I should have said:Can you make text act like a control
budgens
what do you mean with creating a textobject.
Do you mean:
- a string
- a label
- a textbox
- a richtextbox
Computer_Man_With_Questions
By putting [ and ] you can escape the name between them. In this case, since string is a built in keyword in Visual Basic .NET, the compiler would have treated it as the keyword string instead of the type name String.
In this particular case (assuming that you are Importing the System namespace) they just happen to mean the same thing (a string in Visual Basic maps to the System.String class in the .NET framework.
For a more informative example, see:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbls7/html/vblrfvbspec2_2.asp
Best regards,
Johan Stenberg
Dave Poole
Dim s As String = ""
What may have tripped you up is that Strings don't have a argument-less constructor, which means that you can't do something like:
Dim newString As String = New String() ' <-- Error! Can't do this!
Since strings are immutable (you can't change a string after it has been created) it doesn't make sense to have an empty constructor.
Best regards,
Johan Stenberg
sirluke34
For read only text, use a label control and set its text property.
For read/write text, use a textbox control and set its text property.
Best regards,
Johan Stenberg
JeffGrizzle
Mr. Stenberg;
I have come across the syntax,
Dim NewString As [String] = [String].EmptyHow does this syntax change the 'standard' way of decalring a string variable Is this related to a 'string object'
Dim NewString as String = String.Empty
Bontje