Date MaskedTextBox

alex_ea_2a

Member
Joined
Mar 2, 2006
Messages
8
Programming Experience
Beginner
I have simple MaskedTextBox designed to enter dates with the format mm/dd/yy. My code is
Dim dteCurrent As Date = Now
Me.mtxtKeyDate.Text = dteCurrent

...very simple, the result is:

61/22/006_

That means that it reads 6/12/2006, I need 06/12/2006. How can I add that zero that makes the big difference?
 
Why would you use a MaskedTextBox instead of a DateTimePicker? What's to stop the user entering 99/99/9999 in a MaskedTextBox? The DateTimePicker takes care of all formatting and validation for you, plus it provides the user with the additional method of setting the value either with a drop-down calendar or an up-down control.
 
Back
Top