Solved

textbox validation

Posted on 2009-04-06
1
301 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
1 Comment
 
LVL 15

Accepted Solution

by:
oobayly earned 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

28 Experts available now in Live!

Get 1:1 Help Now