Reputation: 11765
Iam using Masked Text box
for inputing a Date.
But I want to set custom date format
for this text box.
How can I set custom date format and validate date on masked text box
control
Upvotes: 3
Views: 6261
Reputation: 38200
I believe you should use a DateTime
Picker for getting such inputs (i think you want it to avoid the mouse probably)
least you can set a mask like 00/00/0000
and later on subscribe for the Validating
event of the maskedtextbox and use Parse
or ParseExact
to verfiy the Date
entered.
In case you want to have blank for date picker then check out this solution remove date
Upvotes: 3