How would I hide all rows on my dataGridView that do not match the date of \"27/11/2013\". Currently the code below hides all my rows...
private void viewOverdue
You should parse your DateTime
to string and then compare.
DateTime dt = DateTime.ParseExact(row.Cells[0].Value.ToString(), "MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
string d = dt.ToString("dd/M/yyyy");
if (!string.Equals(d, "27/11/2013", StringComparison.OrdinalIgnoreCase)) {
row.Visible = false;
}
else
{
row.Visible = true;
}
Also implement the following namespace:
using System.Globalization;