Solved

textbox validation

Posted on 2009-04-06
1
326 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 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…

696 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