//DataGridView的CellValidating验证事件
        private void dataGV1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            decimal tmp=0.0m;
            if(e.ColumnIndex==4&&e.FormattedValue!=null)
            {
                if(!decimal.TryParse(e.FormattedValue.ToString(),out tmp))
                {
                    ControlOpt.ShowMessage("请输入有效数字!");
                    e.Cancel=true;
                   
                }
            }
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-11-28
  • 2021-11-07
猜你喜欢
  • 2021-08-30
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案