brokeMyLegBiking
asked on
declare a string of fixed length
how do you declare a string of fixed length?
Dim myStringVar as String _____
Dim myStringVar as String _____
<VBFixedString(15)> Private YourStringName As String
This attribute has its limitations:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/valrfvbfixedstringattribute.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/valrfvbfixedstringattribute.asp
ASKER
All the <VBFixedString(15)> does is indicate that the string should be fixed length, it doesn't enforce it.
I would likea a way to force an error to be thrown if the wrong string length is assigned.
jong3, how do I declare a char array and assign values to it?
I would likea a way to force an error to be thrown if the wrong string length is assigned.
jong3, how do I declare a char array and assign values to it?
Check this PAQ
I posted an example of how you could create a fixed lenght string class also.
Corey2
I posted an example of how you could create a fixed lenght string class also.
Corey2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Basically, if you want to specify a exact size, you could create a Char array.
You could also just programatically allow a specific sized string to be entered into the variable.