Using a time format on Masked Textbox

ninjatalon

Member
Joined
Sep 22, 2010
Messages
24
Programming Experience
Beginner
i have several masked textbox connected to mysql database through a website i made, and what i'm trying to do is have these masked textbox automatically change the format what the user inputs to "hh:mm tt" so if the user inputs 6 or 600 or 6p it will automatically change it to the format to 6:00 PM . I know that i will have to use the Validated event and I've tried the Format(maskedtextbox1,"hh:mm tt") but can't seem to work.

Can anyone help me please. I would rather not use datetimepicker because i dont want the user have the option of using the dropdown. Thanks
 
I would rather not use datetimepicker because i dont want the user have the option of using the dropdown.
If you select True for ShowUpDown property the dropdown is not available.

The part about MaskedTextBox I didn't quite understand. Changing the Mask according to and after user input would, if possible, make the use of MaskedTextBox control redundant in the first place.
 
ok thanks. I guess i'll just end up using date time picker. is there any way i can clear the time when my program loads that way the user can input the time without confusing the user. thanks
 
ok thanks. I guess i'll just end up using date time picker. is there any way i can clear the time when my program loads that way the user can input the time without confusing the user. thanks
You can set the Value to current date with time part reset to 0, which can be done using the Date property of the Date value:
VB.NET:
Me.DateTimePicker1.Value = Date.Now.Date
 
Back
Top