Can anyone tell me how to format a textbox so that when it gets focus and loses focus that it gets the mask for the short date, "dd,mm,yyyy", that someone will enter?? I need help with this easy one. Thanks.
Printable View
Can anyone tell me how to format a textbox so that when it gets focus and loses focus that it gets the mask for the short date, "dd,mm,yyyy", that someone will enter?? I need help with this easy one. Thanks.
Why not use the masked edit control? You can then set the mask to whatever you like and still grab the text without a mask. Add the Microsoft Masked Edit Control to your toolbox and then add one to the form.
I wanted to see what else I could do in code because I already have my txtboxes in place and in different parts of my code.
Sure.
As you can see, I'm also checking if the text the user enters is a valid date.Code:Private Sub Text1_LostFocus()
If IsDate(Text1.Text) Then
Text1.Text = Format(Text1.Text, "mm,dd,yyyy")
End If
End Sub
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819