Hi. I have a datagridview on a form that displays values generated in a for loop when a user presses a button. Here's the code.

```
Dim i as Integer
Dim Period as double
Dim rate as double
Dim interest as Double
Dim amount as double
Dim payments as Double
'The values for period, rate and amount have been inputed by the user. Payments have already been calculated
For i = 1 to Period
'calculate the interest
interest = (amount * rate) / 12
'calculate the amount
amount = (amount - payment) + interest
'output the data in the data grid view
dgvInterest.Rows.Add()
dgvInterest.Item("Interest",i-1).Value = FormatCurrency(interest)
dgvInterest.Item("Amount",i-1).Value = FormatCurrency(amount)
Next
```

This worked alright but now i want the loop to only display the data from a specific period and not the beginning.

```
For i = 1 to Period
'calculate the interest
interest = (amount * rate)/12
'calculate the amount
amount = (amount - payment) + interest
'output only the desired data in the data grid view
If i >10 Then
dgvInterest.Rows.Add()
dgvInterest.Item("Interest",i-1).Value = FormatCurrency(interest)
dgvInterest.Item("Amount",i-1).Value = FormatCurrency(amount)
End If
Next
```

When I do this i get an error saying that i is out of index. I have tried while loop, do loop to output the data but they all give me the same error.

I only want the data from when the variable i >10 to be displayed on the datagridview.

If anyone can please show me how to effectively do this.