|
-
Sep 19th, 2000, 04:44 AM
#1
Thread Starter
Addicted Member
Hey guys, I have somewhere read the we shouldn't use
Do While but Do Until,
Did you know that? do you know why?
André
-
Sep 19th, 2000, 05:49 AM
#2
I haven't heard that, as both constructs are useful depending on what you want to do. Maybe you read that we should shy away from the "While/Wend" construct because it only remains in the language for backwards compatibility and has been replaced by "Do While/Loop".
"It's cold gin time again ..."
Check out my website here.
-
Sep 19th, 2000, 05:53 AM
#3
Frenzied Member
DO UNTIL means that you want it to do something until something else happens i.e.
Code:
Do
Progressbar1.value = Progressbar1.value + 1
Loop Until ProgressBar1.value = 100
that code will keep adding a 1 to the progress bar wuntil it reaches 100
DO WHILE means that you want it to do someting while something else is happening i.e.
Code:
Do
Progressbar1.value = Progressbar1.value + 1
Loop While ProgressBar1.value = 100
that will add a 1 to the progress bar only if the value of the progress bar is 100
I hope that you understand this
[Edited by dimava on 09-19-2000 at 06:55 AM]
NXSupport - Your one-stop source for computer help
-
Sep 19th, 2000, 06:11 AM
#4
I usually use Do Until.
Code:
Do Until Progressbar1.Value = 100
Progressbar1.Value = Progressbar1.Value + 1
DoEvents
Loop
You could also use the For..Next statement as well.
Code:
For i = 0 to 100
Progressbar1.Value = i
DoEvents
Next i
-
Sep 19th, 2000, 06:46 AM
#5
Thread Starter
Addicted Member
Thanks, I know all of these constructions, the thing is that Bruce is close to what I read. It's an old construct to be fased out.
Thanks guys, have a great day!
André
-
Sep 19th, 2000, 02:49 PM
#6
When dealing with larger loops, using a For...Next loop is much faster than a Do...While loop.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|