|
-
Aug 31st, 2000, 08:11 PM
#1
Thread Starter
Hyperactive Member
Hi,
As I understand, the TextBox control has a limit of 64K characters. Can I somehow increase it throght an API or something?
Thanks
-
Aug 31st, 2000, 08:17 PM
#2
Hyperactive Member
No you can't increase it through an API or something 
If you "could" increase it through an API then it would have been built like that.
The 64k limit is because the control itself only allows for the allocation of 64k of data space to store its contents.
If you want one bigger you would have to write your own control that managed to control the ability to "page" through data, join and unjoin etc.
-
Aug 31st, 2000, 08:44 PM
#3
Either have something like:
Code:
Private Sub Text1_Change()
On Error Goto ClearText
ClearChat:
Msgbox "Textbox has exceed the limit of characters! Text must be cleared!", vbCritical
Text1.text = ""
End Sub
If you don't want that, than I suggest you use a RichTextBox.
-
Aug 31st, 2000, 08:55 PM
#4
Hyperactive Member
Try using a Rich text box instead. It should be able to hold more than 64K characters, seeming that wordpad can open very large documents(Wordpad uses RTF boxes).
Designer/Programmer of the Comtech Operating System(CTOS)
-
Aug 31st, 2000, 08:59 PM
#5
Fanatic Member
The rtf box can allocate up to about 2gb of memory.
should be enough for most people
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 31st, 2000, 09:22 PM
#6
Thread Starter
Hyperactive Member
Thanks Paul, Warmaster & Matthew
Is RichTextBox and an RTF box the same thing? Are you saying that RichTextBox has a limit of 2GB? If not, where can I get a hold on RTF box?
Thanks again.
-
Aug 31st, 2000, 09:30 PM
#7
Hyperactive Member
RTF stands for (R)ich (T)ext (F)ormat
So an RichTextBox means it uses RTF as the source.
If you look at the control you will find a .Text and a .TextRTF.
The first is a straight ASCII of what you entered and the second is a "formatted" version in RTF (ie includes places where you chose to BOLD, color, underline etc)
-
Aug 31st, 2000, 09:33 PM
#8
RichTextBox is same as RTF. It can hold very much. Here is how to load or save an RTF file using the RichTextBox Control.
Code:
'Load File
RichTextBox1.LoadFile "C:\file.rtf", rtfRTF
'Save File
RichTextBox1.SaveFile "C:\file.rtf", rtfRTF
If you want to load/save any text file:
Code:
'Load File
RichTextBox1.LoadFile "C:\file.txt", rtfText
'Save File
RichTextBox1.SaveFile "C:\file.txt", rtfText
-
Aug 31st, 2000, 09:51 PM
#9
Thread Starter
Hyperactive Member
I tried the RTF box,
Works, but it's far less efficient than TextBox (for what I'm doing). I'm generating sequences of numbers (lottery numbers) and wanted to display them all in a TextBox. Problem is that I was going to put up to 14Millions of combinations in a Box (all possible combinations in 6/49). I was playing with only 500 combinations (15000 chars) and that took about 12 seconds to load into a regular TextBox, but TWICE AS LONG with the RTF box, so I need to find a better solution for displaying the combinations. I'm running a Pentium 233MMX/128MB ram.
Any suggestions?
-
Sep 1st, 2000, 05:31 AM
#10
Fanatic Member
carefull with these, don't increment the rtfbox itself
Rtfbox.text = rtfbox.text & MyString
That, in a large loop will run very poorly
If you're working with over 10,000 strings (or looping in more than that) then use two or more steps
eg looping the val out of an array
Code:
Dim TmpString1 As String
Dim TmpString2 As String
For MyLoop = 1 to 20000
TmpString1 = TmpString1 & StrArray(MyLoop)
If MyLoop Mod 500 = 0 then
TmpString2 = TmpString2 & TmpString1
TmpString1 = ""
End If
Next
RTFBox.Text = TempString2 & TempString1
It looks awkward but the performance increase is VERY noticable (which is the point of a perfomance increase) appending to long strings is slow in VB so what you are doing is limiting it's size, much better to use more small strings than one big one. Test the speed difference with 1 tmpstring vs 2, very big difference. And even 1 is bigger than just appending to the RTFbox directly
Cheers
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|