Results 1 to 10 of 10

Thread: TextBox 64K limit

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458
    Hi,
    As I understand, the TextBox control has a limit of 64K characters. Can I somehow increase it throght an API or something?

    Thanks
    Thanks

    Tomexx.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    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.

  3. #3
    Guest
    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.

  4. #4
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    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)

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    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!)

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458
    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.
    Thanks

    Tomexx.

  7. #7
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    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)

  8. #8
    Guest
    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

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Ont, Canada, Earth
    Posts
    458
    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?

    Thanks

    Tomexx.

  10. #10
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    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
  •  



Click Here to Expand Forum to Full Width