I am trying to get the answers to a multiplication problem into a simple list box. The answers should be 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 . . . 45 50.
Here is my code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
For i As Integer = 1 To 5 Step 1
For k As Integer = 1 To 10 Step 1
lstI.Items.Add(i + k)
Next k
Next i
My output skips the 1, but goes to 11. The next line goes from 3 to 12 rather than 2 to 20 by 2s.
What am I doing wrong?