[英]OnValidating Event in a custom control
When does the OnValidate
event fire in the life-cycle of a control? OnValidate
事件在控件的生命周期中何时触发?
I'm creating a DateBox
that will allow the user to enter a date in MM/DD/YYYY format (text) and need to verify that the date is in that format.我正在创建一个DateBox
,它允许用户以 MM/DD/YYYY 格式(文本)输入日期,并且需要验证日期是否采用该格式。 It'll never be converted to a date (stored as string) but I would like to know the best time to validate that data (and provide feedback).它永远不会转换为日期(存储为字符串),但我想知道验证该数据(并提供反馈)的最佳时间。
Note: It may seem a bit like re-inventing the wheel, but the app that I'm writing gets deployed to a tablet-pc and the winforms DateTimePicker
is hell to edit with a stylus and my users just want to be able to write in the date.注意:这似乎有点像重新发明轮子,但我正在编写的应用程序被部署到平板电脑和 winforms DateTimePicker
用手写笔编辑是地狱,我的用户只想能够写在日期。
MaskedTextBox Control might help you. MaskedTextBox 控件可能会对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.