Ok, I see what you mean. I believe you're having this problem because you have defined i as an integer variable set to zero at the top. When you created your For Next loop a new counter variable was set just for the counter. So you have two different i variables.
The i variable in ItemsDataGridView.Rows(i) is always set to zero because you defined it above as zero. Try removing the line
Dim i As Integer = 0, and lets see what happens.
Your code should be,
Dim total As Double
For i = 0 To ItemsDataGridView.RowCount - 1
total += ItemsDataGridView.Rows(i).Cells(3).Value
Next
TotalTextBox.Text = total
|