我如何...输入数字图 [英] How do I...enter numeric figure

查看:70
本文介绍了我如何...输入数字图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生



我有两个文本框,我希望用户只输入数字图形和文本文本中的点(。)。

我怎么能这样做?



提前预定

ajit vyas

解决方案

< blockquote>有两种基本方法:对于WinForms,我强烈建议使用 NumericUpDown类 [ ^ ]而不是文本框 - 它不仅允许您设置允许的最大值和最小值,还会为您转换为数字自动。



对于基于Web的解决方案,您最好使用某种Javascript解决方案。这里有一个很好的: http://www.javascript-coder.com/html -form / javascript-form-validation.phtml [ ^ ]但您必须记住仍然在服务器上进行验证!


dear Sir

I have two textbox and i want user to input only Numeric figure and dot(.)in textboxt.
How can i do this?

thaks in advance
ajit vyas

解决方案

There are two basic approaches: for WinForms, I would strongly recommend using a NumericUpDown class[^] instead of a textbox - not only does it allow you to set a max and min value that is allowed, but it also converts to a number for you automatically.

For a web based solution, you are best with a Javascript solution of some kind. There is a good one here: http://www.javascript-coder.com/html-form/javascript-form-validation.phtml[^] but you must remember to still do validation on the server as well!


这篇关于我如何...输入数字图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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