TextBox problem (more than 65535 char) 
Author Message
 TextBox problem (more than 65535 char)

I want to display some editable text in my VB program, but the text box only
support up to 65535 charachers!

Another question: For STRING in VB, is there a limit?

Please help.



Sat, 21 Sep 2002 03:00:00 GMT  
 TextBox problem (more than 65535 char)
You'll need to use the RichTextBox control. It has approx. 2gb limit (as do strings) but you wouldn't want to load it with that much
data. It gets really sluggish (I wonder why??? ;-) )
Quote:

> I want to display some editable text in my VB program, but the text box only
> support up to 65535 charachers!

> Another question: For STRING in VB, is there a limit?

> Please help.



Sat, 21 Sep 2002 03:00:00 GMT  
 TextBox problem (more than 65535 char)
Why not a Memo field? What are the differences?

--
Peter Bradshaw


Quote:
> You'll need to use the RichTextBox control. It has approx. 2gb limit (as

do strings) but you wouldn't want to load it with that much
Quote:
> data. It gets really sluggish (I wonder why??? ;-) )




Quote:
> > I want to display some editable text in my VB program, but the text box
only
> > support up to 65535 charachers!

> > Another question: For STRING in VB, is there a limit?

> > Please help.



Sat, 21 Sep 2002 03:00:00 GMT  
 TextBox problem (more than 65535 char)
What would a memo field have to do with it? We are talking about controls,
not fields in a database.

I gues you could consider this problem a hazard of crossposting to so many,
unrelated groups.

--
MichKa
(insensitive fruitarian)

random junk of dubious value, a multilingual website, the
54-language TSI Form/Report to Data Access Page Wizard,
and lots of replication "stuff" at the (no scripts required!)
http://www.trigeminal.com/


Quote:
> Why not a Memo field? What are the differences?

> --
> Peter Bradshaw



> > You'll need to use the RichTextBox control. It has approx. 2gb limit (as
> do strings) but you wouldn't want to load it with that much
> > data. It gets really sluggish (I wonder why??? ;-) )



> > > I want to display some editable text in my VB program, but the text
box
> only
> > > support up to 65535 charachers!

> > > Another question: For STRING in VB, is there a limit?

> > > Please help.



Sat, 21 Sep 2002 03:00:00 GMT  
 TextBox problem (more than 65535 char)

says...
Quote:
> I want to display some editable text in my VB program, but the text box only
> support up to 65535 charachers!

> Another question: For STRING in VB, is there a limit?

> Please help.

Hi
I remember this problem. I ran across it when I used VB4. When I got vb5  
I converted my code to use a richtext box.

Try and use a richtext box if you can. If you definately do not have it
there is a work around. You add a scroll control next to the text box and  
read the file in chunks. The scroll bar sets what part of the file to
display. Cute Huh?

I don't have the code I used as I don't need it anymore. I found this on
the web and it looks familiar. I have not tested this code.

good luck

john

Here is an example on how to do this. Create a text box named txtText and
a vertical scoll bar named vsbTest. Set the text box's MultiLine property
to True and the ScrollBars property to 1-Horizontal. The vertical
scrollbar takes the place of the text box's built-in scrollbar, so move
it to the right edge of the form, and change the name of the file in the
Open statement to the name of a file on your disk.

Code:

Option Explicit

Private Const LINES = 15
Private A$()

Private Sub Form_Load()
Dim n
'Load dynamic string array from large text file
Open "c:\file.txt" For Input as #1 Len = 1024
Do Until EOF(1)
n = n + 1
ReDim Preserve A$(n + LINES)
Line Input #1, A$(n)
Loop
Close #1

'Set scrollbar properties
With vsbText
.Min = 1
.Max = n
.SmallChange = 1
.LargeChange = n \ 10
End With
End Sub

Private Sub vsbText_Change()
Dim i as Integer
Dim Tmp$
'Create display string from array elements
For i = vsbTest.Value To vsbTest.Value + LINES
Tmp$ = Tmp$ + A$(i) + vbCrLf
Next i
txtTest.Text = tmp$
End Sub

This code reads the entire large text file into a dynamically allocated
string array. This may
take quite a few seconds to perform the operation the larger the text
file is. Enjoy!



Sat, 21 Sep 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. TextBox problem (more than 65535 char)

2. TextBox problem (more than 65535 char)

3. TextBox problem (more than 65535 char)

4. Textbox control limitation 65535 bytes

5. Textbox control limitation 65535 bytes

6. timer +65535 ms

7. Receving only 65535 bytes when using Inet

8. 65535 Exception: Access Violation

9. 65535 colors conversion

10. problem with char field and special ascii char

11. japanese chars in textbox in VB ? help

12. How meny chars can a textbox contain max?

 

 
Powered by phpBB® Forum Software