Home > Software engineering >  Consult the VB string allows the maximum length of the problem!
Consult the VB string allows the maximum length of the problem!

Time:10-06

Dim strText as string
strText length, maximum allowable as fixed-length string length,
(the original program:
 Private Sub Command1_Click () 

Dim i&
Dim strText As String

For i&=1 To CLng (Text1. Text)
StrText=strText + Str (i&) + ", "
Next i&

Text2. Text=strText

End Sub

(note: Text1) text="100000", allowing Text2. After the program text display "1,... , 10948, 1094, to 1094 is over!" "1,... String length is only 65535, 10948, 1094 ", why want to ask a master variable-length string length is not 2 ^ 32, but 65535? thank you very much!

CodePudding user response:

String can be more than this, but text box can only is 64 k, this is the limitation of Win98 operating system before, VB6 release time is not yet the subsequent system,

CodePudding user response:

Thank you very much people! Problem has been solved! Thank you very much!

CodePudding user response:

VB6 variable-length string "capacity" is 20 m characters,
The TextBox control, can only hold 0 to 65535 characters,
This domain and 16-bit unsigned binary number is consistent,
Even if your strText contains the number of characters in more than 65535,
Assign values to the Text control also truncated,
Control contains only 65535 characters in front of it, and

But I have found that under XP in the code for the Text control after the assignment "full",
Still can input from the keyboard text into it,
At this point if the again for assignment operation, it is beyond the part will be removed again,

CodePudding user response:

http://download.csdn.net/detail/caozhy/7606111

http://download.csdn.net/detail/caozhy/6869155

http://download.csdn.net/detail/caozhy/6869235
http://download.csdn.net/detail/caozhy/6869247
http://download.csdn.net/detail/caozhy/6869257
http://download.csdn.net/detail/caozhy/6869265
Here I upload the Windows virtual machine, Windows98 virtual machine disks and Windows 3.2/95/setup disk of Windows 97, you can experience,

Under the Windows 95/98, if you open a text file is larger than 64 KB, tell you the result is a notepad can not open, ask: do you want to use open wordpad, is because of this limitation, it should be pointed out that, the notepad is to write a complete C language program, it is also limited, is also because of the limitation of the text box itself,

CodePudding user response:

In Win95/98, I can be in only a few bytes of a text file that contains some special characters,
Then open this file with notepad, it will prompt "file is too large, notepad can not open," asked do you want to open with wordpad,


Here another picture, show host:
  • Related