日期:2014-05-18 浏览次数:20928 次
protected override void OnCellValidating(DataGridViewCellValidatingEventArgs e)
{
string c = dgsele.CurrentRow.Cells["编号"].Value.ToString();
if (c != "")
{
MessageBox.Show(" 找不到对应编号!" , "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
e.Cancel = true;
//目前我只能这样清空单元格
SendKeys.Send("{BACKSPACE}");
}
}
//我很奇怪,为什么用下面的代码都无法清空
this.CurrentCell.Value="";
this[e.ColumnIndex, e.RowIndex].Value = "";