dcsimg
November 29, 2020
Hot Topics:

Basics of VB Programming

  • By Sam Huggill
  • Send Email »
  • More Articles »

The Do..Loop is a good way to loop a certain condition depending on different criteria. e.g.

Do
Msgbox "Hi"
Loop

The problem with this code is that it will keep on going forever. You can of course set certain conditions. e.g.

Dim i As Integer
i=10
Do While i>0
i=i-1
Loop

This code will count down from 10 and when i is 0, the loop ends. Another use of this loop is:

Dim i As Integer
i=10
Do Until i=0
i=i-1
Loop

This code will continue until i is 0, and then stop.





Page 5 of 6



This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date