开发者

Windows forms - textbox that accepts specific timestamp format

开发者 https://www.devze.com 2023-02-19 17:51 出处:网络
How can I adda masked textbox in Windows forms that accepts开发者_如何转开发 datetime in the following format:

How can I add a masked textbox in Windows forms that accepts开发者_如何转开发 datetime in the following format:

01/01/1993 12:00 AM


There is a better way to solove this using DateTimePicker

 dateTimePicker1.Format = DateTimePickerFormat.Custom;
 dateTimePicker1.CustomFormat = "MM/dd/yyyy HH:mm";

Best that can be done with MaskedTextbox is by setting following Mask

 maskedTextBox1.Mask = "00/00/0000 00:00 AM"

Then again all of the validations have to be hand written by you.


According MS specification from here, you cannot specify such format. The most nearest meaning mask for your request would be 00\/00\/0000 90:00 \AM

0

精彩评论

暂无评论...
验证码 换一张
取 消