private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
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;
}
}
}
{
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;
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货