文本框中的数字 [英] the number in textbox
本文介绍了文本框中的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我,我在texetbox中将此文本放在databeas中是数字,我如何使该文本不影响垃圾
please help me i have the texetbox this this text in databeas is number how i can make this text dont accebte the litter
推荐答案
如以下堆栈溢出问题中所述:
http://stackoverflow.com/questions/463299/how-do-i-make-a-textbox-that-only-accepts-numbers [
You have a couple options, as specified in this Stack Overflow question:
http://stackoverflow.com/questions/463299/how-do-i-make-a-textbox-that-only-accepts-numbers[^]
由于您仅将问题标记为C#,我不确定是否要在Windows或Web App中执行此操作.
无论如何,我都会使用正则表达式.
首先,可以使用以下RegEx.
As you have only tagges your question to C#, I am not sure if you want to do this in Windows or Web App.
In any case, I would use the regular expressions.
For start, you can use the following RegEx.
Regex regex = new Regex("^[0-9]+
" );
");
阅读有关正则表达式 [
Read more about the Regex [^]class on MSDN.
这篇关于文本框中的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文