hi every one!
I have a datagridview which contain 5 column (data source is a table in ms acces). i want to add 3rd and 4th column using loop
but there is an error occured "input string was not in correct format"
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) //loop to add the total and from column
{string StartTime = dataGridView1.Rows[i].Cells[3].Value.ToString();
string Total = dataGridView1.Rows[i].Cells[2].Value.ToString();
TimeSpan spantotal = TimeSpan.Parse(Total); //convert f into timespan and store in a
TimeSpan spanStartTime = TimeSpan.Parse(StartTime);
TimeSpan SpanEndTime = (spantotal.Add(spanStartTime));// sum of timespan a and b store in c
TimeEnd = new DateTime(SpanEndTime.Ticks);
string strTimeEnd = TimeEnd.ToString("hh:mm tt");
dataGridView1.Rows[i].Cells[4].Value = strTimeEnd; //assign c to to.value
dataGridView1.Rows[i + 1].Cells[3].Value = dataGridView1.Rows[i].Cells[4].Value;//assign to.cell0.value to from.cell1.value