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
Solved

Validate  a mask edit box.

Posted on 2004-10-18
1
333 Views
Last Modified: 2010-04-23
I have a mask edit box for the purpose of entering a time, i.e. "10:15"

In Properties of the mask edit box,
Format is hh:mm
Mask is ##:##
It appears as this "__:__" on my form.

On a certain button click (calculate, to be precise), I want to verify that the user entered a time and did not just skip over that field leaving it blank.

The following three code-attempts do not work:
If mskTimeOut.Text = "##:##" Then
            MessageBox.Show("Please enter rental time out")
            mskTimeOut.Focus()
End If

If mskTimeOut.Text = "" Then
            MessageBox.Show("Please enter rental time out")
            mskTimeOut.Focus()
End If

If mskTimeOut.Text = "__:__" Then
            MessageBox.Show("Please enter rental time out")
            mskTimeOut.Focus()
End If

I have also tried to do a "textchanged" type of code, but it would not let me.

From what I am reading in my books and elsewhere on the internet about mask edit boxes, I gather that they are great for ensuring proper data entry format, but relatively useless for anything else.

Please tell me this is not true - there has to be a way to validate whether a user has entered into this box.
Thanks - A
0
Comment
Question by:veigea41
1 Comment
 
LVL 10

Accepted Solution

by:
123654789987 earned 500 total points
ID: 12344745
Yes it is possible to validate a masked textbox. This is a good link where it has been implemented

http://www.c-sharpcorner.com/Code/2004/Jan/MaskedTextBoxControl.asp
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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