MaskEdBox - using with a custom mask

Looking for an example of how to check data input of the "Canadian Postal Code" using this control.
trudymareschAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
Are you setting the Format or the Mask property?

The mask property is for inputting while the format property is for displaying.

Here is a code sample that works for me:
Private Sub Text1_LostFocus()
    If UCase$(Trim$(Text1.Text)) = "CANADA" Then
        MaskEdBox1.Visible = True
        MaskEdBox1.Mask = ">?#? #?#"
        MaskEdBox1.SetFocus
    Else
        MaskEdBox1.Visible = False
    End If
End Sub
0
 
Éric MoreauSenior .Net ConsultantCommented:
Set the Mask property to: >?#? #?#
0
 
trudymareschAuthor Commented:
Emoreau thanks for responding... Tried this mask.

ON lost focus event with "country" (the previous field) the maskedbox becomes visible and gets focus if the country=Canada.  I can type anything in the maskedbox1 and it will except it.  Isn't it supposed to check the format when entering in the data?  Does the maskedbox control have to be bound to an data control for it to work?

These are probably more than you wanted to answer.....

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Éric MoreauSenior .Net ConsultantCommented:
Is it working for you now?
0
 
trudymareschAuthor Commented:
Hi Emoreau,  I will be working on that project Thursday to make the change and I will let you know.  Its look good, but I have to try it where the project is located.  If you want to post you comment as the answer please do so.  If I have any other problems I will comment further on your answer.
0
 
trudymareschAuthor Commented:
Thanks emoreau, your code worked wonderfully!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.