Microsoft KB Archive/95508

= FIX: Extra Chars in Masked Edit Cause Empty InvalidText Box =

Article ID: 95508

Article Last Modified on 1/8/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Professional Edition

-



This article was previously published under Q95508



SYMPTOMS
Entering more characters than specified in the Mask property of a Masked Edit control generates a ValidationError event, and the InvalidText parameter is set to the empty string.

The InvalidText parameter should be set to the value of the Text property for the masked edit control, including the invalid character.



STATUS
Microsoft has confirmed this to be a bug in the Professional Edition of Microsoft Visual Basic version 2.0 for Windows. This problem was partially corrected in Microsoft Visual Basic version 3.0 for Windows. In version 3.0, the InValidText returned has only as many characters as allowed by the Mask. For example, if the Mask is &quot;##&quot; and you type &quot;123&quot; the InvalidText returned is &quot;12&quot;



Steps to Reproduce Problem
 Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default. From the File menu, choose Add File. In the Files box, select the MSMASKED.VBX custom control file. The Masked Edit tool appears in the Toolbox. In Visual Basic version 3.0, MSMASKED.VBX is automatically installed. Add a masked edit control (MaskedEdit1) to Form1 and change its Mask property to ##.  Add the following code to MaskedEdit1_ValidationError: Sub MaskedEdit1_ValidationError (InvalidText As String,     StartPosition As Integer) 'This must be on a single line. MsgBox InvalidText End Sub  From the Run menu, choose Start (ALT, R, S) to run the program. Type 123 into the masked edit control.</li></ol>

At this point, you'll see an empty message box. Instead of being empty, the message box should display &quot;12&quot; -- the masked portion of the &quot;123&quot; entered in step 6.

Additional query words: buglist2.00 fixlist3.00 2.00 3.00 blank

Keywords: kbbug kbfix KB95508

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.