Hi
Can anyone tell me how to validate a date entry in a text box. I want to ensure that the date is entered as 01/01/05 as opposed to 01.01.05 or 01-01-05. Alternatively can I set it up so that the "/" is placed automatically?
thanks
Printable View
Hi
Can anyone tell me how to validate a date entry in a text box. I want to ensure that the date is entered as 01/01/05 as opposed to 01.01.05 or 01-01-05. Alternatively can I set it up so that the "/" is placed automatically?
thanks
Use a MaskedEdit control instead of textbox. It provides all those features.
Or use a date picker
hi
you can use this code
VB Code:
Private Sub Text1_LostFocus() Text1.Text = Format(Text1.Text, "dd/mm/yy") End Sub ()
I think MaskedEdit control would be the best option....
Thanks to all who replied. I will try out the various suggestions..please ignore the duplicate post
Thanks
Anne
Take a look at This Post
Fadi_r,Quote:
Originally Posted by fadi_r
Using your code try entering the following value into Text1: 010101
You will see that the function returns: 27/08/1927
It returns 27/08/1927 because then this date is 10,101 days greater that 30/12/1899 which I believe is the base date that windows uses to determine the date.
But if you enter 01/01/01 or 01/0/2001 then it will return 01/01/2001.
But I agree with the others a Datepicker is the way to go!