Solved

Validate  a mask edit box.

Posted on 2004-10-18
1
323 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now