WinForm下 TextBox只允许输入数字的小例子
时间:2023-08-02 15:34:14
private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
{
int ikc = (int)e.KeyChar;
if ((!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]")) && ((int)e.KeyChar) != 8)
{
e.Handled = true;
return;
}
}
标签:TextBox,数字
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java编程中使用throw关键字抛出异常的用法简介
2023-08-27 17:04:19
![](https://img.aspxhome.com/file/2023/9/58209_0s.png)
java使用正则表达校验手机号码示例(手机号码正则)
2022-04-07 20:37:04
一篇文章带你深入了解Java基础(2)
2023-12-09 21:06:23
![](https://img.aspxhome.com/file/2023/1/81991_0s.jpg)
SpringBoot注解梳理(小结)
2023-11-10 13:27:19
Kotlin中ListView与RecyclerView的应用讲解
2023-01-24 01:26:44
SpringBoot配置自定义拦截器实现过程详解
2022-11-04 17:24:48
C#使用符号表实现查找算法
2022-08-07 01:16:45
![](https://img.aspxhome.com/file/2023/8/122678_0s.jpg)
Kotlin基础学习之lambda中return语句详解
2023-09-04 16:33:41
mybatis-plus 拦截器敏感字段加解密的实现
2023-12-20 05:58:17
C# DataTable 转换为 实体类对象实例
2021-12-25 02:14:51
java中 ${} 和 #{} 有什么区别
2023-11-29 01:34:32
![](https://img.aspxhome.com/file/2023/5/67015_0s.png)
C#的编码规范详细说明
2022-01-13 10:07:43
JavaGUI常用三种布局使用介绍
2023-05-19 08:01:06
![](https://img.aspxhome.com/file/2023/6/73036_0s.png)
SpringBoot2 实现JPA分页和排序分页的案例
2022-02-23 13:26:08
Spring Boot中的那些条件判断的实现方法
2023-04-26 15:02:07
基于Android实现百度地图定位过程详解
2021-06-12 20:55:34
![](https://img.aspxhome.com/file/2023/8/129018_0s.png)
Java实现微信公众号发送模版消息
2021-07-16 17:03:35
![](https://img.aspxhome.com/file/2023/7/79337_0s.jpg)
C#实现的JS操作类实例
2023-11-13 05:19:48
MultipartResolver实现文件上传功能
2021-06-19 22:38:15
C#属性(Attribute)用法实例解析
2021-09-20 16:01:29