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. Do while loop execute when the given condition is true, when condition is true entering the loop and increase the number and again execute
Copy and paste below Code:
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
Loop
End Sub
End Class
No comments:
Post a Comment