Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

inet1 issues quick question

hi there i have a form that does this. ( in a nutshell )

inet1.host = "host here"
inet1.execute blah blah blah
inet1.execute blah blah blah
inet1.execute blah blah blah
inet1.execute blah blah blah

i need it to WAIT between the executes... until the first one is done before it moves onto the next one... how can i do that? Thanks
[364 byte] By [vchatlive] at [2007-11-11 10:09:50]
# 1 Re: inet1 issues quick question
One approach is to use a "finite state machine": Create a form-level variable to track the current state. Call the first .Execute method, then add code to the Inet control's StateChanged event to detect that the operation is complete. In the StateChanged event, update the form-level state variable, then call the next .Execute method. Something like this:

Option Explicit
Private Enum eFtpState
Step1
Step2
Step3
End Enum
Private FtpState As eFtpState

Private Sub Form_Load()
FtpState = Step1
DoFtp
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
If State = icResponseCompleted Then
Select Case FtpState
Case Step1
FtpState = Step2
DoFtp
Case Step2
FtpState = Step3
DoFtp
End Select
End If
End Sub

Private Sub DoFtp()
Select Case FtpState
Case Step1
Inet1.Execute "Step1"
Case Step2
Inet1.Execute "Step2"
Case Step3
Inet1.Execute "Step3"
End Select
End Sub
Phil Weber at 2007-11-11 17:23:04 >
# 2 Re: inet1 issues quick question
very interesting, i ended up with a do until statement,
execute blah blah blah
do until inet1.stillexecuting = flase
do events
loop
execute blah blah

and it seemed to work jsut fine.

any advantages to the code above?
vchatlive at 2007-11-11 17:24:06 >
# 3 Re: inet1 issues quick question
for some reason though my code isnt working its only doing the first file then it stops any ideas?
vchatlive at 2007-11-11 17:25:15 >
# 4 Re: inet1 issues quick question
got it figured out added if statement for if its workign go to next1, next 2 etc.
vchatlive at 2007-11-11 17:26:09 >