|
-
Oct 30th, 2003, 12:13 AM
#1
Thread Starter
Lively Member
Simple Loop problem
Code:
Private Sub cmdret_Click()
Dim n As Integer
n = "1"
myurl = "http://www.site.com/cgi-bin/locate.pl?id=" & n
Do While n < 1000
n = n + 1
WebBrowser1.Navigate2 (myurl)
Inet1.Protocol = icHTTP
Inet1.Execute CStr(txturl), "GET /"
While Inet1.StillExecuting
DoEvents
Wend
call command1
Loop
'MsgBox "Done"
End Sub
What I am trying to do is loop through and change "n" each time until "n" reaches 1000. Must call command 1 each time "n" changes. Any help is appreciated.
Last edited by tarctor; Oct 30th, 2003 at 12:19 AM.
-
Oct 30th, 2003, 01:47 AM
#2
Frenzied Member
VB Code:
Private Sub cmdret_Click()
Dim n As Integer
For n = 1 to 1000
n = n + 1
myurl = "http://www.site.com/cgi-bin/locate.pl?id=" & n
WebBrowser1.Navigate2 (myurl)
Inet1.Protocol = icHTTP
Inet1.Execute CStr(txturl), "GET /"
While Inet1.StillExecuting
DoEvents
Wend
Call command1
Next n
'MsgBox "Done"
End Sub
-
Oct 30th, 2003, 07:07 PM
#3
Thread Starter
Lively Member
For some rreason When I use this "n" is changing from 1 to 3 to 5 and so on. What am I missing?
-
Oct 30th, 2003, 09:17 PM
#4
Fanatic Member
"Next n" automatically increments the value of n in a For..Next loop, so you don't need n=n+1 inside the loop. That just adds an extra increment causing the For...Next loop to increment by Step 2.
-
Oct 30th, 2003, 09:23 PM
#5
Frenzied Member
Crap, I can't believe I missed that. Here try this:
VB Code:
Private Sub cmdret_Click()
Dim n As Integer
For n = 1 to 1000
myurl = "http://www.site.com/cgi-bin/locate.pl?id=" & n
WebBrowser1.Navigate2 (myurl)
Inet1.Protocol = icHTTP
Inet1.Execute CStr(txturl), "GET /"
While Inet1.StillExecuting
DoEvents
Wend
Call command1
Next n
'MsgBox "Done"
End Sub
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
|