I have a problem "Index Out Of Range Exception In C#" while reading Datgridview,
Actually i have a DataGridview. DataGridForm2 with 3 rows ,1 column..
Like .. Status
---------
completed
---------
completed
----------
" " ---- Empty string..
I tried to read this datgridview with the below code:
int j = dataGridForm2.Rows.Count;
j = j - 1;
for (int i = 0; i < j; i++)
{
object value1 =dataGridForm2.Rows[i].Cells[i].Value;
}
But while second iteration that is i=1 , i got error Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I dont know how to solve this problem, since i am fresher to .Net.
Please let me know my Error in above codings?
Thanks.

New Topic/Question
Reply




MultiQuote






|