用户输入时间 [英] Time Input by User
本文介绍了用户输入时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在开发窗口应用程序.我必须在用户指定的时间[hh]:[mm]:[ss]发送电子邮件并关闭应用程序.
因此,我必须让用户输入时间.我在表格上放置了maskedTextBox.在这里,我希望用户不能输入hh:大于24,mm:ss大于60.如何实现?
或者,您可以重新请求Web上可用的任何输入时间输入控件.
问候!
Aman
Hi All,
I am working on window application. I have to email and close application on user specified time[hh]:[mm]:[ss].
So, I have to get time input by user. I placed a maskedTextBox on form. Here I want that user should not be able to enter hh: more than 24, mm:ss greather than 60. How to implement this?
Or You can recommand any inbult time input control available on web.
Regards!
Aman
推荐答案
为什么不使用数字上陷 [< ^ ],以便限制用户在所需范围内进行选择输入.
依次使用三个数字来实现相同的效果.
Why don''t you use Numeric Updown[^] so that user will be restricted to choose among required range of inputs.
use three numeric up down back to back for achieving the same.
您可以将DateTimePicker修改为 ^ ].您可以将格式更改为Custom
而不是Time
并将CustomFormat
属性设置为HH:mm:ss
以获得24小时的显示/修改.
You can modify the DateTimePicker to only display time[^]. You can change the format toCustom
instead ofTime
and set theCustomFormat
property toHH:mm:ss
to get 24 hour time display/modification.
看看:
如何:使用正则表达式约束ASP.NET中的输入 [
Take a look at this:
How To: Use Regular Expressions to Constrain Input in ASP.NET[^]
You can try to match against
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])\s([0-1]\d|2[0-3])(:[0-5]\d){2}
这篇关于用户输入时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文