如何以窗口形式验证日期为dd/mm/yyyy格式 [英] how to validate date as dd/mm/yyyy format in window form
本文介绍了如何以窗口形式验证日期为dd/mm/yyyy格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何在asp.net中将日期验证为dd/mm/yyyy格式,但现在我想在窗口中将日期验证为dd/mm/yyyy格式我该怎么办?请帮助
i know how to validate date as dd/mm/yyyy format in asp.net but now i want to validate date as dd/mm/yyyy format in window how can i do this please help
推荐答案
John Simmons为您提供了一个很好的开始,现在将IFormatProvider和DateTimeStyles添加到DateTime.TryParse方法中,或者,您可以尝试添加3个单独的框,一个一天,一个月,另一个月,一年
John Simmons gave you a good start, now add the IFormatProvider and the DateTimeStyles to the DateTime.TryParse method, or in the other hand, you can try to add 3 separate boxes, one for day, one more for month and the last one for year
您可以使用DateTime.TryParse
.如果返回true,则日期有效.
You could use DateTime.TryParse
. If it returns true, the date is valid.
我认为尝试使用带遮罩的文本框会帮助您
尝试使用带遮罩的文本框进行验证
i think try with masked text box it will helps you
try to validate with masked text box
这篇关于如何以窗口形式验证日期为dd/mm/yyyy格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文