I understood that a string in VB .Net maximum length was quite large (could be way over 1000 characters) but do not know for sure. I keep having a problem when I concatenate one string to another and the result is the second string.

Str1 = “this is the first test”
Str1 &= “this is the second test”

Now Str1 = “this is the second test”

The lengths of the strings in the example are not correct (much longer) but are under 1000 characters. Does anyone have a clue?

7 Years
Discussion Span
Last Post by __avd

I figured out the problem. There was a NULL character in the string causing me to not see the first part of the string.


The theoretical limit may be 2,147,483,647, but the practical limit is nowhere near that. Since no single object in a .Net program may be over 2GB and the string type uses unicode (2 bytes for each character), the best you could do is 1,073,741,823, but you're not likely to ever be able to allocate that on a 32-bit machine.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.