I am using following code for sum of grid view column.
Dim a, b, c As Decimal
For i = 0 To GridItem.Rows.Count
a = Convert.ToDecimal(GridItem.Rows(i).Cells(7).Value.ToString())
c = c + a
Next
txtBasic.Text = c
System throws an error:Object reference not set to an instance of an object.
after debug the code I understand the problem.I add 2 rows in grid view.
Problem is system shows Gridview1.Rows.Count=3.
as per count for loop iterate 3 times 3rd time system throws an error:Object reference not set to an instance of an object.
1st time I entered =500.2nd time=2000.at second iteration of for loop value of c=2500.