现在我的datagridview中有一列是DataGridViewCheckBoxColumn 想当我选中以后当前行的某一列就变为可编辑状态问题:当可编辑以后 这一列的值是数字 当我输入字母时 会弹出DataError的提示框
然后我在DataError事件中写了判断数据类型的语句 但是这样只要你的这一行的数据不符合条件那么他会一直提示、
无法进行任何操作
求高手指点
然后我在DataError事件中写了判断数据类型的语句 但是这样只要你的这一行的数据不符合条件那么他会一直提示、
无法进行任何操作
求高手指点
http://blog.csdn.net/fangxinggood/archive/2007/04/11/1561011.aspx#A17
{
double d= 0.0;
dataGridView1.Rows[e.RowIndex].ErrorText = string.Empty;
if(dataGridView1.Columns[e.ColumnIndex].DataPropertyName == "A")
{
if(!double.TryParse(e.FormattedValue.ToString(),out d) || d<0.0)
{
dataGridView1.Rows[e.RowIndex].ErrorText = "输入有误!";
e.Cancel = true;
}
}
}