'Learn how to use a Do While Loop.PublicClass Form1
Inherits System.Windows.Forms.Form
PrivateSub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) HandlesMyBase.Load
'display the numbers from 0 to 9Dim i AsInteger'method 1DoWhile (i < 10)
TextBox1.Text = TextBox1.Text & i & ","
i = i + 1
Loop
i = 0 ' reset i'method 2Do
TextBox2.Text = TextBox2.Text & i & ","
i = i + 1
LoopWhile (i < 10)
EndSubEndClass' Let us take a closer look at our do while loop:'----------------------------------------------------------------' Do While (i < 10)' TextBox1.Text = i' i = i + 1' Loop'----------------------------------------------------------------' Do While - do while loop' i < 10 - loop while i less than 10' i=i+1 - increment o' Loop - loop while i less than 10'----------------------------------------------------------------'Description:'Loop until argument is set.'Warning! The do while loop can crash your program if "done wrong".'-----------------------------------------------------------------------------
Visual Basic .Net Source Code
I hope you found this VB .Net tutorial useful!
Don't forget to mention Apron Tutorials in your References!