form 'crash' during http request.

Stephanieb

Member
Joined
Jun 1, 2003
Messages
18
Hi,

I have a form in which I run http requests (this one can take a while to complete). For this I use a component that basically waits untill the request is complete. Meanwhile, my form appears crashed even though its not. The title bar shows not responding as well.

I wish to have a live update on the form as to what requests have been completed - as there will be a few.

Does anybody have any suggestions to how I can do this the best (and easiest)?

Thanks,
Stephanie :)
 
thanks!

do you have any code examples of this? I have not tried doing this before - but herard elsewhere this would work.

Stephanie :)
 
Sure!

Supose you have a method that processes the web request

Code:
Public Sub MakeWebRequest()
     Code to make the web request
End Sub

All you have to do is to create a thread object and make it call the web request method

Code:
Public Sub Controller()
     code here

     Dim t as New Threading.Thread(AddressOf MakeWebRequest)
     t.Start()

     more code here
End Sub

From now on the MakeWebRequest sub will be free to run independently from your Controller sub.
 
Just a question, I have now set this up to run a different thread as you said. I made different classes to do the submission and the controlling in the same project.

In debug mode it does not appear to run on a different thread ie the timer does not tick (but also, the form does not show not responding in the titlebar anymore). Is this going to be different when its not running in debug mode?

Thanks,
Stephanie :)
 
no worries, seems to work a treat now - thanks!!!

what I did wrong was, I started the thread after intialising it, and then calling the procedure afterwards. So I had a thread running, and another one running the procedure in the original thread - silly me!!!

:)
 
Back
Top