hi i have a question i have some code that works good on like 70% of the computers i use it on but.. for some reason theres a few that are pesky and id like to do something like this (keep in mind this is a hypothetical)
private void test_click(object sender, EventArgs e)
{
MessageBox.Show("hi");
//if it works ok without a error it continues to
MessageBox.Show("worked ok");
//if it encountered a error of some kind it would go to
MessageBox.Show("DID NOT WORK OK");
}
What about try-catch (or try-catch-finally)?
Attention: Here I use a global
catch( Exception )which should be used with care, only! For a test method this is no problem, but do not do this in production code. You should at least specify the expected exception there and think about how to handle the situation.