Do Until Loop In VB.NET

How to use Do Until Loop?

Explanation

Do Loop Until Statement

Do Loop Until Statement executes a set of statements until a condition becomes false, this is an infinite loop might have to terminated using Ctrl + Break .
Syntax:

Do
[Statements]
Loop Until [Condition]

In the above syntax the Statements are executed until the Condition becomes false.
Example:

Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim X As String
Do
X$ = InputBox$("Correct Password Please")
Loop Until X$ = "Ranger"
End Sub
Description:

In the above Do Until Loop example, a input box is displayed until the correct password is typed.

Visual Basic Tutorial


Ask Questions

Ask Question