So, I make a small agenda, and I insert the to-do list into the database and populate it DataGridViewwith DateTime.Now, when I saved it. If I forget to do something from this list, it will display a notification and say that I forgot to do it.
I want to use a TimeSpanmaximum of hours, and it will only display a notification if it passes 2 hours.
This is the code that I have at the moment:
private void GetSpan()
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
TimeSpan span = (DateTime.Now - Convert.ToDateTime(row.Cells[2].Value));
String.Format("{0} hours, {1} minutes, {2} seconds",
span.Hours, span.Minutes, span.Seconds);
}
}
The problem with this code is that it gives me only one result, and not all of them from each line DataGridView. So how can I convert it to an array and get each result?