Looks like you need to implement
CellFormatting
. The docs you can find here:
DataGridViewCellFormattingEventArgs Class (System.Windows.Forms) | Microsoft Docs[
^]
Your implementation will then look something like this
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs formatting)
{
if (e.ColumnIndex == 17)
{
if ((DateTime)dataGridView1.CurrentRow.Cells[17].Value == DateTime.MinValue)
{
formatting.Value= "";
}
}
}
Better to work with column names than indices
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs formatting)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "Column3")
{
if ((DateTime)dataGridView1.CurrentRow.Cells["Column3"].Value == DateTime.MinValue)
{
formatting.Value= "";
}
}
}