Solved

Validate  a mask edit box.

Posted on 2004-10-18
1
330 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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