Solved

Validate  a mask edit box.

Posted on 2004-10-18
1
342 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
[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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

695 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