>> 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