What i want is, If no exception raised, the buttons 6 and 8 become visible to user. The finally block runs regardless of exception, so i wouldnt put it there
if (worksheet == null)
return;
try
{
Range allo = worksheet.Rows.Cells[72, 2];
allo.Value = AcceptableNoise.SelectedItem.ToString();
}
catch (Exception ee)
{
if (ee.Data != null)
{
_ = MessageBox.Show("One or more Options not selected " +
"\n Eg: Confirm that Actuator Type is selected"/*ee.ToString()*/, "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else
{
button8.Visible = true;
button6.Visible = true;
}
}
finally
{
excel2.DisplayAlerts = false;
excel2.ActiveWorkbook.Save();
excel2.Application.Quit();
excel2.Quit();
/// = MessageBox.Show("You are done");
}