Masked Edit Box

steutermann
steutermann used Ask the Experts™
on
I am trying to create a mask for a masked edit text box that requires the first 6 digits to be letters, the next 2 or 3 digits need to be a number, followed by a - (dash) then 2 letters.

I have created the following mask: >??????###-??

But, I cannot make it allow me to put a space in the ### portion.

Example:  These are both valid ABCDEF12-MO or ABCDEF123-MO
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dirk HaestProject manager

Commented:
Replace ### by &&&

??????&&&-??

Author

Commented:
I have replaced the ### with &&&, but when I press the spacebar in the 3rd &&& position, all it does is beep instead of putting a blank.
Project manager
Commented:
2 possibilities to solve problem:
Problem gets comes through <

1st one
Use this mask: ??????###-??

Add this procedure
Private Sub MaskEdBox1_LostFocus()
    MaskEdBox1.Text = UCase(MaskEdBox1.Text)
End Sub

2nd one

Use this mask: ??????###-??
Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
 if keyascii not ....
(select here all the value that are allowed)
End Sub

Author

Commented:
Thanks for help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial