BUG: Setting Focus to a Masked Edit Control Causes Error (150186)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q150186 SYMPTOMS
Setting focus to a Masked Edit control, which previously did not have the
focus, triggers the ValidationError event of the control. If the Masked
Edit control loses the focus, the ValidationError event is fired again.
The InValidText parameter received in the event represents the invalid
characters that the user tried to type. When the event is fired erroneously
because the control receives focus, the InValidText parameter is one
character long, and becomes the same as the PromptChar. The example below
avoids warning the user if a control is used to set focus to the control:
Private Sub MaskEdBox1_ValidationError(InvalidText As String, _
StartPosition As Integer)
If Mid$(InvalidText, StartPosition + 1, 1) <> MaskEdBox1.PromptChar Then
MsgBox "You are typing in the wrong stuff"
End If
End Sub
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 3/14/2005 |
---|
Keywords: | kbBug kbControl kbpending KB150186 |
---|
|