BUG: Setting Focus to a Masked Edit Control Causes ErrorLast reviewed: May 2, 1996Article ID: Q150186 |
The information in this article applies to:
SYMPTOMSSetting 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.
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.
WORKAROUNDThe 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 InvalidText <> MaskEdBox1.PromptChar Then MsgBox "You are typing in the wrong stuff" End If End Sub MORE INFORMATION
Steps to Reproduce Problem
Private Sub MaskEdBox1_ValidationError(InvalidText As String, _ StartPosition As Integer) If InvalidText <> MaskEdBox1.PromptChar Then MsgBox "You are typing in the wrong stuff" End If End Sub |
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |