c/s程序如何限制textbox中输入值必须为数字
如题,
C# code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar != 8))
{
e.Handled = true;
}
}
textBox1.ImeMode=ImeMode.Number;
不知道成不
刚刚看过CSDN推荐的一个帖子,关于判断字串是否全为数字的效率问题
楼主可以去看看
用ASC码判断可以
在KeyPress事件中判断ASC码。
找一个NumberBox的源代码看看吧。
google 上一搜就有了
请注意:CTRL + V 和SHIFT + INSERT 粘贴
在KeyPress里判断输入的字符
<asp:TextBox ID="TextBox1" runat="server" onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"/>
相关问答:
#include"stdio.h"
#include"stdlib.h"
void ContrTwo(char i)
{
char str1[8];
itoa(i,str1,2);
printf("%s",str1);
}
unsigned char leftRot(char str,int i);
unsign ......
我只学过清华蓝封面的C语言基础,想更深入的学习,该看什么书好?
C Primer Plus
C程序设计语言(第2版新版)
C语言程序设计_现代方法
C语言参考手册第五版
C语言大全
C和指针
C陷阱与缺陷
C专家编程
......
帮帮忙,谢谢~
1. Write a program to perform a topological sort on a graph.
2. Write a program to solve the single‐source shortest‐path problem (Dijkstra
algorithm).
3. Write a program ......
VC6.0不能用,VS系列太大,能不能推荐几款小巧的C/C++的IDE
没有。楼下的垃圾回答
http://topic.csdn.net/u/20100105/09/c854cc79-c8b0-4c1a-a8cf-9ab001ab13a5.html?76698
VC6.0我windows7能用
其他的
DEV ......