General discussion

Locked

Under what circumstances is try..catch{} OK ?

By Tony Hopkinson ·
Bettter yet if this was in the setter method of a public property, with an event handler in it?

.NET 2.0 set the binding source property (listBox, Combox etc..), this fires SelectedItemChanged.
Put any code in the event handler that throws an unhandled exception, and the component f'ing swallows it.

try
{
bs = value;
}
catch
{
displayvalue = "";
}

I know how to get round it, there's even a comment in there about why teh code looks strange.

What I can't figure out is why some one at Redmond thought this was the way to go.

What am I missing.?

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Given the overwhelming volume of responses

by Tony Hopkinson In reply to Under what circumstances ...

Apparently nothing

Collapse -

Actually, Tony

by Tig2 In reply to Given the overwhelming vo ...

Timing is everything. I will bet that Wayne and Locrian will have an opinion at the very least. But it is the weekend and for some, a long weekend. So you didn't attract the attention you deserve to attract.

Bubble back up during the week and you will likely get better response.

Back to Windows Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums