Reputation: 5366
Can I just do this below? Or is there a more proper way to do it ?
ServiceReferenceSLHS.HighScoreWSClient client = new ServiceReferenceSLHS.HighScoreWSClient();
client.GetHighScoresCompleted += new EventHandler<ServiceReferenceSLHS.GetHighScoresCompletedEventArgs>(client_GetHighScoresCompleted);
try
{
client.GetHighScoresAsync();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
Upvotes: 0
Views: 133
Reputation: 65586
Your code will only capture errors generated when calling the method GetHighScoresAsync
. It's normally very unlikely that you'll have sure exceptions.
It's much more likley that you want to capture exceptions in the callback function (client_GetHighScoresCompleted
).
Check the EventArgs there for errors.
Upvotes: 1