Could someone give me a direction on this?
This code from another source (with a minor change by me to print a bunch of "x"'s instead of blank spaces), suggests that you can use the API to get a textbox to hold more than 65535 characters. When I try it, the textbox is just plain white...no characters. At least none that I can see. I have gone to my API reference and everything looks just like it should be. So I am thinking the problem is because I haven't included code to tell what color to use for the text. Is this the case?
Many thanks!
Code:Option Explicit 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 Const WM_SETTEXT = &HC Private Const EM_SETSEL = &HB1 Private loopo As Long Private Sub Command1_Click() 'Getting textbox to hold more than 65535 characters 'Code by strongm at tek-tips.com, 6/2/2008: 'Controls: 'Command button named "Command1". 'Textbox named "Text1", w vertical scrollbar. Dim result As Long Dim maxstring As String ' Simple demo that we can go over 65535 by just one extra character 'maxstring = Space(65535) + "x" For loopo = 1 To 65536 maxstring = maxstring + "x" Next loopo SendMessage Text1.hwnd, WM_SETTEXT, 0&, ByVal maxstring Debug.Print Len(Text1.Text) ' Note that once we've actually got the text into the textbox we can get it out (or information about it) OK SendMessage Text1.hwnd, EM_SETSEL, Len(Text1.Text), Len(Text1.Text) Exit Sub ' Ok, let's be silly, and go with, say, 64Mb + 1... maxstring = Space(1024& * 1024 * 64) + "x" SendMessage Text1.hwnd, WM_SETTEXT, 0&, ByVal maxstring Debug.Print Len(Text1.Text) ' Position selection at end to demonstrate that Textbox can happily hold and ' display rather more text than we might expect ... ' Cannot use Textbox's own SetSel because that is limited by MS to a max of 65535 ' (mind you, you'll notice a performance problem SendMessage Text1.hwnd, EM_SETSEL, Len(Text1.Text), Len(Text1.Text) End Sub


Reply With Quote
. I was having problems with an RTB and I was wondering if it had a limit. But it was another problem. But in the meantime, I was researching textbox limits and ran into this bit of code. So I thought I would just play with it and maybe add it to my "vb toolkit" for future use. But it doesn't print like it should.