Catching exceptions thrown by an asynchronous call

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
 
H

Henning Krause [MVP - Exchange]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top