[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Catching exceptions thrown by an asynchronous call

John Skandar

8/3/2008 7:56:00 PM

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


----
Dr. John Skandar
<yugo_amaryl@msn.com>

1 Answer

Henning Krause [MVP - Exchange]

8/3/2008 8:34:00 PM

0

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

"John Skandar" <yugo_amaryl@msn.com> wrote in message
news:FE73709F-57C4-4601-AF9D-299F64D4E795@microsoft.com...
> 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
>
>
> ----
> Dr. John Skandar
> <yugo_amaryl@msn.com>