Hello,
I have a DataGridViewTextBoxColumn that is bound to a DateTime column which allows nulls. I can't figure out for the life of me how to allow the user to delete the text out of this column and get the DataGridView to successfully parse the text back to DBNull.
I thought it would be as simple as handling the CellParsing event:
But the DataGridView throws the DataError dialog up.
How are you supposed to do this?
I have a DataGridViewTextBoxColumn that is bound to a DateTime column which allows nulls. I can't figure out for the life of me how to allow the user to delete the text out of this column and get the DataGridView to successfully parse the text back to DBNull.
I thought it would be as simple as handling the CellParsing event:
Code:
private void grdEnrollment_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
{
if (e.Value == "") {
e.Value = DBNull.Value;
e.ParsingApplied = true;
}
}
But the DataGridView throws the DataError dialog up.
How are you supposed to do this?