FIX: TextBox Does Not Scroll to the Caret Position

ID: Q181945


The information in this article applies to:


SYMPTOMS

When changing the TextBox.SelStart to a position that is not visible in the TextBox, the TextBox does not scroll to the caret position.


RESOLUTION

The TextBox needs to be sent an EM_SCROLLCARET message after the SelStart is set. Because Windows API calls cannot be made from a Windows CE Toolkit for Visual Basic 5.0 (VBCE) project, the API would need to be wrapped as a method in a Windows CE Toolkit for Visual C++ 5.0 (VCCE) control that could be used in the VBCE project.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

This problem was corrected in Windows CE Toolkit for Visual Basic 6.0.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Windows CE Project in Visual Basic 5.0. Form1 is created by default.


  2. Add a TextBox to Form1.


  3. Set the MultiLine property of the TextBox to True.


  4. Place a CommandButton on Form1.


  5. Add the following code to Form1:
    
          Private Sub Form_Load()
             Text1.Height = 495
          End Sub
    
          Private Sub Command1_Click()
             Dim x
             Text1.Text = "Line 1" & vbCrLf &  _
                          "Line 2" & vbCrLf &  _
                          "Line 3" & vbCrLf &  _
                          "Line 4"
             Text1.SetFocus
             x = InStr(Text1.Text, "Line 4")
             Text1.SelStart = x
          End Sub 


  6. Press the F5 key to run the project. Click on the CommandButton and note that the text box does not scroll to the caret.


Additional query words: vbce vbce5 vbce6 wince


Keywords          : kbToolkit kbVBp kbVBp500bug kbVBp600fix kbWinCE kbWinCE100 kbGrpVB 
Version           : WINDOWS:1.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: March 12, 1999