So I doing a small agenda and I will insert the to-do list into a database and populate it in the DataGridView along with the DateTime.Now when I saved it. If I forget to do something of that list it will display a notification and tell me that I forget to do that.
I want to use a TimeSpan of a maximum of hours and it will only display the notification if it passes the 2 hours long.
This is the code 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 of this code is that it's only gives me one result and not all of them from each row of the DataGridView. So how can I convert it into an array and get each result?