C# DateGridView 单元格输入验证方法 由 狂野の屠夫 · 2018 年 2 月 21 日 目的用于限制 VS 原生 DataGridView 控件单元格输入验证,有如下两种办法: 方法一: 定义全局变量 bflag: private bool bflag =false; 然后,在 PreviewKeyDown 事件中添加如下代码: if (Grid.CurrentCell.ColumnIndex == 1) { if (((e.KeyValue