From: Bu on
Hello

In VB6 the textbox can hold up to 65536 characters. Is there a box/dll
that comes with VB6 that does not have this limit?

Bu

From: NeilH on

"Bu" <si(a)si.si> wrote in message
news:6bvo649638jnnrdhc3m343ebrsv6umkmqr(a)4ax.com...
> Hello
>
> In VB6 the textbox can hold up to 65536 characters. Is there a box/dll
> that comes with VB6 that does not have this limit?
>
> Bu
>

RichTextBox


From: Larry Serflaten on

"Bu" <si(a)si.si> wrote

> In VB6 the textbox can hold up to 65536 characters. Is there a box/dll
> that comes with VB6 that does not have this limit?

64K is not a limit of the textbox, it is more a limit of the textbox interface.
If handled carefully, you can put more than 65536 characters in a normal
textbox. For an example, add a textbox to a new form and set its
MultiLine property to True and its Scrollbars property to 2 (Vertical).
then paste in the following code and try it out....

LFS

Private Sub Form_Load()
Dim txt As String
Dim lin As Long, ofs As Long

' Build a large string of text
txt = "This is line # " & vbCrLf & Space$(2500004)
Mid(txt, 27) = txt
lin = 1
For ofs = 16 To Len(txt) Step 26
Mid(txt, ofs) = CStr(lin)
lin = lin + 1
Next

' Assign it to the textbox (SelText)
Text1.Text = ""
Text1.SelText = txt
Text1.SelText = "This is the last line."

' Check its length (2,500,052 characters!)
MsgBox "Text1.Text length = " & CStr(Len(Text1.Text))
End Sub


From: expvb on
> "Bu" <si(a)si.si> wrote in message
> news:6bvo649638jnnrdhc3m343ebrsv6umkmqr(a)4ax.com...
>> Hello
>>
>> In VB6 the textbox can hold up to 65536 characters. Is there a box/dll
>> that comes with VB6 that does not have this limit?

The underlying control used by the text box was limited in Windows 9x to
64K. This has increased in NT4 and after to the amount of available memory,
but VB6 still treat it at 64K max, but you could get around this as Larry
mentioned.

RichTextBox Control is not limited to 64K, but the text is treated as RTF by
default. I am not sure if there is a property that you can set to make it
ignore RTF codes, but you can send EM_SETTEXTMODE to the control to switch
it to plain text mode. Below is a sample code to do that, however, it seems
there is a bug in the control when you paste Rich Text to it, so you have to
intercept Ctrl+V and change the text yourself if necessary. Search the
newsgroups for "EM_SETTEXTMODE bug".

Option Explicit

Private Const WM_USER As Long = &H400
Private Const EM_SETTEXTMODE As Long = (WM_USER + 89)

Private Const TM_PLAINTEXT = 1
Private Const TM_RICHTEXT = 2 '/* default behavior */
Private Const TM_SINGLELEVELUNDO = 4
Private Const TM_MULTILEVELUNDO = 8 '/* default behavior */
Private Const TM_SINGLECODEPAGE = 16
Private Const TM_MULTICODEPAGE = 32 '/* default behavior */

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long

Private Sub Form_Load()
EnablePlainTextMode RichTextBox1
End Sub

Private Sub EnablePlainTextMode(ByVal rtf As RichTextBox)
Dim ret As Long

' RichTextBox must be empty before changing the mode
rtf.Text = ""
ret = SendMessage(rtf.hwnd, EM_SETTEXTMODE, _
TM_PLAINTEXT Or TM_MULTILEVELUNDO Or TM_MULTICODEPAGE, ByVal 0&)
Debug.Print "EnablePlainTextMode: EM_SETTEXTMODE returned " & ret
If ret <> 0 Then
' EM_SETTEXTMODE failed
Debug.Print _
"EnableTextMode: EnablePlainTextMode failed, LastDllError = " &
_
Err.LastDllError
End If
End Sub




From: Bu on
On Thu, 03 Jul 2008 09:21:17 +0200, Bu <si(a)si.si> wrote:

>Hello
>
>In VB6 the textbox can hold up to 65536 characters. Is there a box/dll
>that comes with VB6 that does not have this limit?
>
>Bu

All,
Rhanks for the responses.

Bu