What is the meaning of UserName = String(33, 0)
in VB 6.0 and what will be the equivalent in C#.
Please help I'm getting error while converting VB 6.0 code into C#.
Thanks in advance.
String
in VB6 is a function that returns a string containing a repeating character string of the length specified.
String(number,character)
example:
strTest = String(5, "a")
' strTest = "aaaaa"
strTest = String(5, 97)
' strTest = "aaaaa" (97 is the ASCII code for "a")
In this case, String(33,0)
will return a string containing 33 null characters.
The equivalent in C# would be
UserName = new String('\0', 33);
Thanks a lot ... now i got the concept.
Actually it returns a Variant of subtype String. String$() is the preferred version of this function.