datagridview 限制某列只能输入数字(方法一)
来源:互联网 发布:个人博客整站源码 编辑:程序博客网 时间:2024/05/22 03:31
c#,datagridview
添加EditingControlShowing事件
public DataGridViewTextBoxEditingControl CellEdit = null;private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e){ if (this.dataGridView1.CurrentCellAddress.X == 4)//获取当前处于活动状态的单元格索引 { CellEdit = (DataGridViewTextBoxEditingControl)e.Control; CellEdit.SelectAll(); CellEdit.KeyPress += Cells_KeyPress; //绑定事件 }}private void Cells_KeyPress(object sender, KeyPressEventArgs e) //自定义事件{ if ((this.dataGridView1.CurrentCellAddress.X == 4) || (this.dataGridView1.CurrentCellAddress.X == 5) || (this.dataGridView1.CurrentCellAddress.X == 6))//获取当前处于活动状态的单元格索引 { if (!(e.KeyChar >= '0' && e.KeyChar <= '9')) e.Handled = true; if (e.KeyChar == '\b') e.Handled = false; }}
0 0
- datagridview 限制某列只能输入数字(方法一)
- datagridview 限制某列只能输入数字
- datagridview 限制某列只能输入数字
- datagridview 限制某列只能输入数字
- winform下dataGridView中限制某列只能输入数字
- dataGridView中限制某列/单元格只能输入数字
- DataGridView中限制某列只能输入数字
- DataGridView 列大写、列只能输入数字
- C# datagridview 某列只能输入英文或数字
- datagridview 只能输入数字
- 限制只能输入数字的方法
- js限制只能输入数字的方法
- C#中DataGridView实现某一列只能输入数字
- C#中DataGridView实现某一列只能输入数字
- 限制只能输入数字
- dataGridView中只能输入数字
- 如何限制数据窗口的某列只能输入数字及符号 -
- 限制文本框只能输入数字
- Flask, Angularjs共存之道
- 算法训练 最短路 Bellman-Ford
- jQuery选择器 过滤选择器(六.表单对象属性过滤选择器)
- [二分] cf 768B Code For 1
- Fragment 出栈的方法popBackStack需要特别注意的一点
- datagridview 限制某列只能输入数字(方法一)
- iOS之WKWebview中cookie问题的解决办法
- mysql创建组合索引
- 微服务架构基础——解读六边形架构
- 工作用到的基础知识
- Java servlet 实现时钟效果
- Spring MVC中使用Thymeleaf模板引擎
- 项目:高校工资管理系统(甘特图)
- Android开发教程精粹30篇