BUG: Can't Set SelStart Property of RichTextBox to > 32KLast reviewed: December 9, 1996Article ID: Q160233 |
The information in this article applies to:
SYMPTOMSYou cannot set the SelStart property of RichTextBox controls that contain text greater than 32K (32768) characters in length to a value greater than 32767 and less than the text length. Although this is a legal range, SelStart is automatically set to the text length. Consequently, you cannot make selections within this range.
STATUSMicrosoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.
WORKAROUNDUse the SendMessage API of USER32 with the EM_EXSETSEL parameter to set the SelStart position:
Private Const WM_USER = &H400 Private Const EM_EXSETSEL = (WM_USER + 55) Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long Private Sub Command1_Click() Dim x As String x = String(32800, "a") RichTextBox1.Text = x '''[THE NORMAL WAY] RichTextBox1.SelStart = 32790 SendMessage RichTextBox1.hwnd, EM_EXSETSEL, 0, 32790 RichTextBox1.SelLength = 10 MsgBox RichTextBox1.SelText End Sub MORE INFORMATION
Steps to Reproduce Problem
|
KBCategory: kbprg kbbuglist
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |