15. For Loop

This tutorial will introduce you to one of the first intermediate parts of the language, the For Loop. This loop will allow you to execute any code a certain amount of times. There are other types of loops which will be covered later on in the series.

Code

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim i As Integer = 0

        For i = 0 To 10
            MessageBox.Show("The value of i is: " & i)
        Next

    End Sub

End Class