hi there,

i have a code to display data from a database to a dataagrid view and while adding data i add rows also to the datagrid view but when the second time the code runs it gives an exception saying index tou of bound, how can i solve this.
i have attached the the doc with the error msg and the code. the dt.row.count = 2.

thanxxx

You have used "1" as the starting index in the for loop. You should use "0".

Try this:

for (int r = 0; r < dt.Rows.Count; r++)
{
   .....
}

Thanks