
Urgent help required with VB Dates/Mask Edit Control!!!
I can't say this technique works for VB4, but it works well for
me in VB3. I usually just use a plain old text box for date
input and let the user key whatever they want in whatever format
they want. Then I edit like this:
If Not IsDate((txtTheDate.Text)) Then
MsgBox "Invalid Date"
Exit Sub
Else
'convert to a date type (variant)
vntNewDate = CVDate((txtTheDate.Text))
'output as desired format (if necessary)
txtTheDate.Text = Format$(vntNewDate, "Short Date")
End If
Keep in mind that I just typed the code above in. I didn't copy
it from a program so there may be some errors. However, it does
so the technique I use. The good thing about it is that the user
can key the date anyway they want to. The IsDate function will
do it's best to decipher a date from it.