|
-
Oct 21st, 2000, 01:46 AM
#1
Thread Starter
Lively Member
Hello,
Could any one tell me why and when
we use do loops with example .
Bye
-
Oct 21st, 2000, 04:00 AM
#2
Frenzied Member
Do loops are used to repeat some event until some action happens which is going to stop the loop.This loop will loop until or while that action has happened.It is mosy often used when we don't know how many times we want something to happen but it depends of the user or smth. else.
Code:
Do While Form1.Top < 5000
Form1.Top = Form1.Top + 20
Loop
This will move the form down while its top position is smaller than 5000.
Code:
Do Until Form1.Top > 5000
Form1.Top = Form1.Top + 20
Loop
This does the same thing just instead of while we use until.
-
Oct 21st, 2000, 06:12 AM
#3
Code:
Dim f as integer
f = freefile
Dim InputStr as string
open "C:\Windows\desktop\mydata.txt" for input as #f
do while not EOF(f)
line input #f,inputstr
'do some processing with each line of the file
loop
close #f
-
Oct 21st, 2000, 09:39 AM
#4
If you know how many times you want to loop, it's better to use a For loop as it is slightly faster.
Code:
For I = 0 To MyNumber 'i.e 1000
Print "Hello"
Next I
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
|