16. Do While

This tutorial will show you how to use the Do While loop in Visual Basic .NET. The Do While loop will allow you to execute a piece of code while a condition is true, sort of like an If Statement.


Public Class Form1

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

        Dim num1 As Integer = 1

        Do While num1 < 10
            MessageBox.Show("The value of num1 is :" & num1)
            num1 = num1 + 1

    End Sub

End Class