首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

CellValidating验证异常怎么清空单元格

2012-02-02 
CellValidating验证错误如何清空单元格?C# codeprotected override void OnCellValidating(DataGridViewCe

CellValidating验证错误如何清空单元格?

C# code
        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 = ""; 


[解决办法]
难道是因为清完后没刷新

热点排行