然后是C#小数点后的一位数

然后是C#小数点后的一位数

本文介绍了如何使文本框接受小数点前最多两位数,然后是一个必需的小数点,然后是C#小数点后的一位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有文本框,允许用户输入小时数。

它只允许数字和小数值。

现在如何允许用户输入最多两位数在十进制之前,然后是小数点,然后是一位数。







ex:

1.2或12.5或仅12 --->有效值





但是当用户尝试输入12 ..或1211或122等值时.----->在有效值中,文本框不应该允许..



并且用户不能输入多个小数点。

I have text box which allows user to enters hours.
It will allow only numeric and decimal values.
So now how to allow user enters max of two digits before decimal, followed by decimal point, and then followed by single digit.



ex:
1.2 or 12.5 or just 12 ---> valid values


but when the user tries to enter values like 12.. or 1211 or 122. ----->In valid values, the text box should not allow..

And user should not be able to enter more than one decimal point .

推荐答案


这篇关于如何使文本框接受小数点前最多两位数,然后是一个必需的小数点,然后是C#小数点后的一位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:55