Basically, you "ignore" that error - you need to go into a wait state until the FTP command has completed. In the code that actually executes the command, I would suggest something like the following:
inetFTPControl.Execute , fStr_FTPCommand
While inetFTPControl.StillExecuting
DoEvents
Wend
and in the StateChanged event handler you do what is necessary after completing of the command
Private Sub inetFTPControl_StateChanged(ByVal rInt_FTPState As Integer)
Select Case rInt_FTPState
Case icError
<Handle the Error>
Case icResponseCompleted
<Handle the Completion of Command>
Case icNone
Case icResolvingHost
Case icHostResolved
Case icConnecting
Case icConnected
Case icRequesting
Case icRequestSent
Case icReceivingResponse
Case icResponseReceived
Case icDisconnecting
Case icDisconnected
End Select
End Sub
Hope this helps Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
There is a VB instruction called DoThings(). What this
does is make the current subroutine see if there are any
other events that also need to be "taken care of" (such
as terminating the program when a button is clicked, etc).
I put doevent loops after each execute statement now!
however its not going into the StateChanged procedure.
I'm firing of a PUT statement, and then a DIR statement. The file i'm trying to put into the ftp path does not get copied and the statechanged procedure does not fire off for the dir results.
The StateChanged is an event of the Inet control. I would suggest that first rename your existing StateChange event subroutine to some other name. Then you double click on the control from the from, and that should create the proper event handler. Then you can copy the code from your renamed procedure into the newly created event handler.
To handle the results from the DIR Command, you'll need to use the .GetChunk method of the INET control to get the directory listing.
Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
Perhaps you should post the code Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
Case icResponseCompleted
vtData = Inet1.GetChunk(1024)
MsgBox vtData
Case icNone
Case icResolvingHost
Case icHostResolved
Case icConnecting
Case icConnected
Case icRequesting
Case icRequestSent
Case icReceivingResponse
Case icResponseReceived
Case icDisconnecting
Case icDisconnected
End Select
End Sub
It could be that the event is being fired, but since the input parameter is called State, and the case statement variable is rInt_FTPState, the Case statement doesn't do anything. Either change the Parameter name, or the case statement variable.
There is no reason to have the .Cancel method where you have it. I would however, put the .Cancel in the error handling section of the StateChange event.
I don't know what the FTP server on the other end is doing, but I perfer on the PUT command to explicity identify the location and name of the file that I'm copying up. Good Luck
-------------- As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
However i have a msgbox on the first line of the state change procedure, and this has never been fired! Its just not going into the state procedure *shrugs*
will look at the PUT command and add the full file lengths, but the 'dir' statement should surely fire the state procedure??
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.