I'm trying to count the Date cells in my datagridview, then display the total of cells but only if the date is today.
So in brief, if my datagrid contains 2 dates that are today my label will read "2" really I would like it to say "You have 2 appointments today" in one label.
Below is some code I'm using but it's not counting correctly?
if (row.IsNewRow) break;
object obj = row.Cells[2].Value;
DateTime dt;
if (!DateTime.TryParse(obj.ToString(), out dt)&& dt.Date == DateTime.Today) count++;
{
label2.Text = count.ToString();
}