Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping a certain amount of times

Status
Not open for further replies.

OzzieBloke

Programmer
Mar 28, 2004
31
AU
Is there a way to repeat a command a certain amount of times??

Basically, I want the user to set how many times that a command is executed. However everything that I try doesn't work.

I have tried

i = 0
Do Until i = Int(Repeat.Text)
string
i = i + 1
Loop

String is the code which is meant to execute, yet does not.
 
Couldn't you set repeat.text = intCnt

Dim intcnt As Integer

repeat.text= 10
intcnt = repeat.text

Then

i = 0
Do Until i = intCnt
string
i = i + 1
Loop

??????????????????????????????????????????
Only a guess
 
Sorry, I worked out the problem, what I had was correct, the problem was in a different part of the code.
 
Maybe use the For loop instead:

For i = 0 to Int(Repeat.Text)
{actions}
next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top