Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can any Guru tell me how to ensure proper date format?

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
Can someone tell me the simplest way to make sure that a user enters a date into a text box as 04/30/04.

I can't use a date time picker because it slows down the data enter process.

Please explain or provide examples as I am still learning VB.Net.

I would prefer if the slashed came up automatically. I have had no luck with the ActiveX masked edit box or the FlexEditMaskBox.

Thanks in advance Guru,



ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
I have an alternative way to check for the date the user input as date data type, but this doesn't require how users input the date. They can type 04-04-04, 09/04/04, or 4/4/2004. When submit data use isdate function to check if it a date. If not return to the user and ask for correct date form. I don't know that this works with your project.


if isdate(textbox1.text) then
'correct date
else
'incorrect date
end if
 
Perhaps I said this once before but I use Componentone (wich is part of the vb.net resourcekit) dateedit control wich allows for manual input or input via a dropdown datepickercontrol.
Or you could use the flexmaskedit use this mask "99/99/99" and then do what codefun suggests.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Do not attempt to have the delimiters come up automatically. This really frustrates the data entry person when they make a mistake and need to backspace or delete to correct it.

Also, your original post was not really clear. Is your question related only to format, or are you concerned about dd/mm/yy vs mm/dd/yy regional differences?
 
Thanks for all your resopnses.

The flexmaskedit seems to have problems with dates that do not have two characters in the month or day. For example 1/27/2004 shows as 12/72/004. It seems to try and fill those both positions of the ##/##/#### mask.

Date picker is not an option as it will slow down the data entry crew. This application is to replace an existing Access application. Access has a built in input mask feature that allows the user to only enter the numerical value of a date and it will automatically insert the slashes. In Access these slashes being there are not a problem when you back space.

The whole purpose of this is to keep the application as friendly as possible and not add to the data entry departments keystrokes. This is a large measure of their productivity rating.

What is Componentone?

Thanks again for all your resopnses.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top