none
What is wrong with my For...Next statement? RRS feed

  • Question

  •  Private Sub btnForNext_Click(sender As Object, e As EventArgs) Handles btnForNext.Click
            ' Displays a multiplication table.
            Dim intNum As Integer
            Dim intNum2 As Integer
    
            Integer.TryParse(txtNumber.Text, intNum)
            For intNum1 As Integer = 1 To 9
                intNum2 = intNum * intNum1
                lblTable.Text = lblTable.Text &
                    intNum.ToString & " * " &
                    intNum1.ToString & " = " &
                    intNum2.ToString & "   " & ControlChars.NewLine
                intNum1 += 1
            Next

    I've tried it a couple different ways, but my table comes out wrong when i'm using the For...Next statement ( practicing different methods). I can't seem to wrap my head around it.

    It comes out like this

    Instead of this

    Tuesday, February 26, 2019 4:06 AM

Answers

All replies