FIX: Text Box/Mask Edit in Select Mode If MsgBox in LostFocus (95509)



The information in this article applies to:

  • Microsoft Visual Basic Standard Edition for Windows 2.0
  • Microsoft Visual Basic Professional Edition for Windows 2.0
  • Microsoft Visual Basic Standard Edition for Windows 1.0

This article was previously published under Q95509

SYMPTOMS

If you use the mouse to click a text box or a Masked Edit control moving the focus off a control that executes a MsgBox statement in its LostFocus or ValidateError event, the insertion point goes into select mode once the message box is closed. After closing the message box, if you move the mouse cursor from side to side of the Text Box or Masked Edit control, text in the control is selected based on the point where the mouse was clicked to move focus to the Text Box or Masked Edit control. Clicking the mouse anywhere within the Text Box or Masked Edit control turns off select mode.

STATUS

Microsoft has confirmed this to be a problem in the Standard and Professional Editions of Microsoft Visual Basic version 2.0 for Windows and in Microsoft Visual Basic programming system version 1.0 for Windows. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.

Steps to Reproduce Problem

  1. Run Visual Basic, or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.
  2. Add a text box (Text1) to Form1.
  3. Add a command button (Command1) to Form1.
  4. Add the following code to Command1_LostFocus.
          Sub Command1_LostFocus
             MsgBox "Command1 LostFocus Event"
          End Sub
    						
  5. From the Run menu, choose Start (ALT, R, S) to run the program.
  6. Click the Command1 button to bring the focus to it.
  7. Click the x in Text1 in the text box. The message box appears. Click the OK button to Close the message box.
  8. Move the mouse cursor over the word Text1 in the text box and then move it left or right.
When you move the mouse cursor from side to side of the Text Box, you select the text on either side of the x in Text1. The insertion point should not select text; it should only represent the entry point for any text entered.

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:kbbug kbfix KB95509