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 = "";
{
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 = "";
Tchange = e.Control as TextBox;
清空要用
Tchange.Text="";