文本框仅接受0到24个数字! [英] Textbox accepts only 0 to 24 numbers!

查看:61
本文介绍了文本框仅接受0到24个数字!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在将C#与.net 4.0一起使用.在文本框中,当我们输入数字时,文本框仅接受24个以下的数字!(如果输入25、26,27 ...这些数字将不会显示在该文本框中),同时文本框仅接受两个小数(例如:12:00,1:00 .....).

有可能这样做吗?谁能帮我!!

Hi,

I''m using .net 4.0 with C#. In text box when we enter numbers that text box accept only below 24 numbers!( If we enter 25, 26,27... these numbers will no display in that text box) , at the same time that text box accepts two decimals only (Ex: 12:00,1:00.....).

It is possible to do this? Can any one pls help me !!

推荐答案

使用文本框上的RangeValidator 控件.
在此示例中 [
Use the RangeValidator control on the textbox.
In this example[^], only values between 30 and 40 are accepted.


或者您可以使用正则表达式 [ ^ ]之间.使用 RegularExpressionValidator控件 [
Alternatively you can use regular expressions[^]. Use RegularExpressionValidator Control[^]


将文本框属性设置为maxlenghth = 24
To set textbox property as maxlenghth=24


这篇关于文本框仅接受0到24个数字!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆