?
Solved

textbox validation

Posted on 2009-04-06
1
Medium Priority
?
337 Views
Last Modified: 2013-11-26
hi, quick question, i want to add validation to a text box on my form, what is the easiest way.

the textbox stores time, so i want it to be able to type in 1200 and it split the string and add a : sign, so it would add it as 12:00?

thanks
0
Comment
Question by:kipl20
[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 15

Accepted Solution

by:
oobayly earned 500 total points
ID: 24077962
If it's a windows form, you could use a MaskedTextBox control and set the mask property to "0000".

Better yet you could use a DateTimePicker control, and set the Format property to  DateTimePickerFormat.Custom, the CustomFormat property to "HH:mm" and the ShowUpDown property to true.
Then you can retrieve the time as a string using:
Dim timeString As String = dateTimePicker1.Value.ToString("HH:mm")
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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