Catching exceptions thrown by an asynchronous call

  • Thread starter Thread starter John Skandar
  • Start date Start date
J

John Skandar

I've found a free WebService on the net for a currency converter and have
created a class to use it with the WSDL tool.

I call the WebService method asynchronously:

converter.ConversionRateAsync((Currency)fromCurrencyComboBox.SelectedIndex,
(Currency)toCurrencyComboBox.SelectedIndex);

Where do I have to put the catch instruction?
If I try to run the instruction above when I am not connected to the
Internet, I receive a message with a System.Net.WebException exception.
Where can I catch it?

Thanks
 
Hello,

you have a ConversionRateCompleted event. Attach an eventhandler to that
event. When called, examine the e.Error property - if it is not null, you
got an exception.

Kind regards,
Henning Krause
 
Back
Top