Legacy VB6 also support strings of up to 2^31 characters, assuming you had enough memory.
The textbox control technically is only designed to hold up to 64K worth of text.
Dim a As String
Private Sub Form_Load()
a = Space$(1000000)
Text1.Text = a
This code loads a string with a million spaces.
It assigns the string to a textbox.
It prints out the length of the Text property of the textbox.
The print will say 65535.
You could scroll through all 1 million characters, in the textbox, but if you did something like TextBox1.SelStart = 80000, you would get an exception.
So, while the control is designed to support 64K characters, because it is using a String for the Text property, the String itself (thus the Text property) can hold more characters then the contol is designed to handle, and if not careful, you can have problems.
You really shouldn't use the textbox to hold more characters than it is designed for.
Now, you probably thought the string was limited to 65,535 characters because your are defining a fixed length string, i.e.
Dim b as String*65535
and fixed length strings are limited to 65535 characters.
A fixed length string is allocated once in local process memory, and never changes size.
If you assign a short string to it, it is padded out with spaces.
If you use a dynamic string, it is allocated out on the heap and the size of the string is however many characters you assigned to it.
If you assign more or less characters to the string, the string expands or shrinks (usally by reallocating new space for the new sized string, and garbage collecting the old space later).
The dynamic string can be whatever size, up to 2^31 characters, that your memory will support.
We have plenty of examples, where a string is sized to match the size of a file, then the whole file is read into the string in one shot.
Sizing a string to a reasonable size buffer, then not modifying it's size, but manually keep track of how many characters you put in the buffer using the Mid$ statement on the left size of an assignment is a very efficient way to manipulate or add to a string, without inccuring the overhead of the string reallocation that is done when you change the size of the string through things like concatenation.