DataGridView之DataError

解决思路一:

 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;

原文地址:https://www.cnblogs.com/YYkun/p/7110906.html