Solved

MaskEdBox - using with a custom mask

Posted on 2000-03-02
6
450 Views
Last Modified: 2013-12-26
Looking for an example of how to check data input of the "Canadian Postal Code" using this control.
0
Comment
Question by:trudymaresch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2578595
Set the Mask property to: >?#? #?#
0
 

Author Comment

by:trudymaresch
ID: 2580729
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
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 100 total points
ID: 2580984
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2587388
Is it working for you now?
0
 

Author Comment

by:trudymaresch
ID: 2588825
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
 

Author Comment

by:trudymaresch
ID: 2602452
Thanks emoreau, your code worked wonderfully!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question