Do Loops on Visual Basic

A Do Loop executes a line, or lines of code until a specific condition is met. It is sometimes referred as Do While Loops to some.

For example, you want to let the user enter names in a database until the user types the word Finish in an input box, or maybe until the user clicks the Done button. In that case, you can use a Do [While] Loop cycle until the next string Finish is entered or until the user clicks the Done button.

A Do [While] Loop has several formats, depending on where and how the loop condition is evaluated. The most common syntax used is:

Do While (condition)
       code block
       or
       block of statements
       to be executed
Loop




More examples will be posted soon.




Based on the book, Step by Step Microsoft Visual Basic 6.0

No comments:

Post a Comment

Extended Search

Custom Search
Hello World