How to set a timeout

  • Thread starter Thread starter Hurley
  • Start date Start date
H

Hurley

I have a windows application that is using a webservice to get some
information used in the program. However, when I use the program
behind a firewall, the program just hangs there, trying to access this
webservice all the time, without reaching it. How can i set a timeout
in my program that can make it stop trying to reach that webservice?

Try
rate = objExchange.getRate(strCountry1, strCountry2)
lblUpdate.Text = "Last updated: " & Date.Now
Catch ex As Exception
lblUpdate.Text = "Connection failed"
End Try
lblKurs.Text = rate


Anyone have any suggestions? Thank you in advance,
Hurley
 
Hi Hurley,

Threading.thread.sleep(1000) ' is one second
This is the current thread

I hope this helps?

Cor
 
Thank you so much for your answer. Sorry to be a pain. But I'm pretty
new to VB and don't quit understand how to work with this thread class.
I tried to play around with it and to have a look in the MSDN library,
but I still can't figure out how to use this in my code. Any chance that
I can get an example or better description on how to use this?

Thank you again,
Hurley
 
Hi,

You only have to put this in your code and your program will sleep on that
place

It is a kind of a wait

Cor
 
Back
Top