PDA

Click to See Complete Forum and Search --> : icError


jsayson
Jul 19th, 2000, 10:48 AM
I have a program that uses the Inet control. My problem is once it encounters an error (icError in StateChanged event to be specific) my program will freeze. I've tried to issue an Inet.Cancel statement but to no avail. HELP!!!


Here's a portion of my code....

Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error GoTo Errors
Select Case State
Case icNone
Me.Caption = ""
.
.
.
Case icError
Inet1.Cancel
Case icResponseCompleted
Me.Caption = "Completed..."
End Select

End Sub

[Edited by jsayson on 07-19-2000 at 01:06 PM]

dj4
Jul 20th, 2000, 12:51 AM
Cancel method not working great. But if you want using Cancel try this.

Do While Inet1.StillExecuting
Inet1.Cancel
DoEvents
Loop

-Dj4

jsayson
Jul 20th, 2000, 07:49 AM
O yah, that's a great idea. But what I want is for my program to exit gracefully in case it encounters the icError state.

dj4
Jul 21st, 2000, 12:50 AM
I don't know how that works but try:

Select Case State
...
Case icError
Inet1.Execute , "QUIT"
Do
DoEvents
Loop While Inet1.StillExecuting

OR

Inet1.Execute , "CLOSE"
Do
DoEvents
Loop While Inet1.StillExecuting

End Select

-Dj4

jsayson
Jul 21st, 2000, 10:37 AM
I think the example you've shown to me works only on FTP. Here's my inet statement.


public function xxxx()
do until ....
inet1.cancel
Buffer = Inet1.OpenURL(txtURL.Text, icString)

......process the contents of buffer here
loop
end function


what my appl will do is to retrieve the HTML code of the given URL only not download it. usually my appl will be able to loop and retrieve a few thousands of data before it encounters the icError. And once it encounters the error it immediately hung's up. I suspect that error is related to timeout request, but what I want is for my program to exit gracefully instead of being locked-up.