You can try this way :
string thisDay = DateTime.Today.ToString("d");
var duplicateRow = (from DataGridViewRow row in dataGridView1.Rows
where (string)row.Cells["columnName"].Value == thisDay
select row).FirstOrDefault();
if (duplicateRow != null)
{
//duplicate row found, update it's columns value
duplicateRow.Cells["columnName"].Value = thisDay;
}
else
{
//duplicate row doesn't exists, add new row here
}
That uses linq to select a row having particular column value equal current date. When no row match the criteria, .FirstOrDefault()
will return null
, else it will return first matched row.