DataGridView某个单元格只输入小数
来源:互联网 发布:东北林业大学网络 编辑:程序博客网 时间:2024/05/22 06:11
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
e.CellStyle.BackColor = Color.Aqua;//设置编译时的颜
}
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (dataGridView1.Rows[e.RowIndex].IsNewRow) { return; }
decimal newInteger;
if (e.ColumnIndex == 4 || e.ColumnIndex == 6)
{
if (e.FormattedValue != null && e.FormattedValue.ToString().Length != 0)
{
if (!decimal.TryParse(e.FormattedValue.ToString(), out newInteger) || newInteger < 0)
{
e.Cancel = true;
MessageBox.Show("请输入数字或小数","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
}
- DataGridView某个单元格只输入小数
- DataGridView单元格只输入小数或整数
- DataGridView单元格输入大写字母
- 文本框只输入小数
- C# dataGridView限制某一行的单元格只输入数字的方法之一
- datagridview为某个单元格添加按钮
- 设置表格单元格只能输入小数
- C# datagridview限制单元格输入数字
- C# DataGridView 获取当前单元格输入内容
- DataGridView的单元格控制只能输入数字
- DataGridView的单元格控制只能输入数字
- JS只允许输入数字和小数
- datagridview 限制某列能输入正整數,还能输入小数
- 关于DataGridView无法对某个单元格赋值的解决办法
- vb.net DataGridView 改变某个单元格字体的颜色
- 设置鼠标光标在DataGridView某个单元格中的位置
- input输入框只输入整数两位小数
- 控制datagridview单元格只能输入数字 VB2005(收藏)
- 单元测试..内置
- 动态设置全屏,退出全屏
- Ad Hoc Distributed Queries 的启用与关闭
- Asp.net中防止用户多次登录的方法
- chrome之view
- DataGridView某个单元格只输入小数
- MFC 中添加 C 文件
- tomcat-users配置文件
- doc 下解决mysql 中文乱码问题
- 设计包含min函数的栈
- oracle的主要内容,基本概念
- 错误mysql version wrong or lib not find,check mysql_config for more information解决
- Linux私房菜+课后练习第十章
- 初识oracle job