Solved

textbox validation

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 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

19 Experts available now in Live!

Get 1:1 Help Now