How would I hide all rows on my dataGridView that do not match the date of "27/10/2013" by comparing it with whatever is in the DatePaid column. I have checked my mdb database (which I'm pulling the data from) and DataPaid has a datatype of ShortText, so no conversion to DateTime is necessary. Currently the code below hides all my rows.
public void viewOverdue_Click(object sender, EventArgs e)
{
viewOverdue.ForeColor = Color.Red;
viewHistory.ForeColor = Color.Black;
viewHire.ForeColor = Color.Black;
viewRent.ForeColor = Color.Black;
CurrencyManager manager = (CurrencyManager)BindingContext[dataGridView1.DataSource];
manager.SuspendBinding();
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (!string.Equals(row.Cells[0].Value.ToString(), "27/10/2013", StringComparison.OrdinalIgnoreCase))
{
row.Visible = false;
}
else
{
row.Visible = true;
}
}
manager.ResumeBinding();
}