|
|
 |
'Learn how to use a Do While Loop.
Private Sub Form_Load()
'display the numbers from 0 to 9
Dim i As Integer
'method 1
Do While (i < 10)
Text1.Text = Text1.Text & i & ","
i = i + 1
Loop
i = 0 ' reset i
'method 2
Do
Text2.Text = Text2.Text & i & ","
i = i + 1
Loop While (i < 10)
End Sub
' Let us take a closer look at our do while loop:
'----------------------------------------------------------------
' Do While (i < 10)
' Text1.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 Source Code |
I hope you found this Visual Basic tutorial useful!
Don't forget to mention Apron Tutorials in your References!
Best Regards
Ronny André Reierstad
|
|
|