解决思路一:
private void dgvChargeList_DataError(object sender, DataGridViewDataErrorEventArgs e) { bool handle; if (dgvChargeList.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.Equals(DBNull.Value)) handle = true; else { handle = false; e.Cancel = handle; } }
解决思路二:
设置属性ShowCellErrors=false;