VB6.FixedLengthString(#) - Alternate
-
I was wondering if anyone had a good solution to replacing VB6.FixedLengthStrings(). I need to be able to have a constant length for strings in a function. I tried Dim str As String = Space(#), and that works fine until you set the string to its value (spaces disappear), so its apparent that is not the correct way to fix this problem. Ive been thinking about testing to see the difference between the max length of the value and the max length of the string, but I'm not sure how to put a certain number of spaces to the end of the string as you cannot insert spaces with string.insert(pos, chars). Any thoughts? Nathan Lindley
-
I was wondering if anyone had a good solution to replacing VB6.FixedLengthStrings(). I need to be able to have a constant length for strings in a function. I tried Dim str As String = Space(#), and that works fine until you set the string to its value (spaces disappear), so its apparent that is not the correct way to fix this problem. Ive been thinking about testing to see the difference between the max length of the value and the max length of the string, but I'm not sure how to put a certain number of spaces to the end of the string as you cannot insert spaces with string.insert(pos, chars). Any thoughts? Nathan Lindley
-
Dim sVal as string Or CONST MIN_SIZE as int16 = 15 Dim s As String = "" s = "Hello" s = s.PadRight(MIN_SIZE, " ")