S
Shannon Lloyd
Hi,
I've got some code which raises or lowers (ie enables or disables) the
SIP on a PPC in order to allow text to be entered when the focus is in
particular controls (eg text boxes). The current scenario is that the
user checks a checkbox, which raises/enables the SIP and puts the focus
into a particular textbox. The problem occurs when the user *unchecks*
the checkbox - the CheckStateChanged event for this lowers/disables the
SIP, but for some reason an exception is being thrown here. So I
surrounded the call to "inputPanel.Enabled = false;" with a try/catch
clause, which catches the exception and displays a MessageBox for
debugging purposes (so I know that the exception is being caught), but
then the MessageBox immediately vanishes (before any user interaction)
and the entire application exits! Am I missing something here? Isn't the
point of exception handling that it allows the software to *handle* the
exception when it occurs instead of allowing it to ascend up through the
call stack until the runtime terminates the process?
FWIW, the particular block of code looks like this:
try
{
this.inputPanel.Enabled = false;
}
catch (Exception e)
{
MessageBox.Show("Exception disabling SIP: " + e.Message);
}
Oh, and I don't get time to even read the output of e.Message before the
process is killed, so I'm not sure what type of Exception is being
thrown. But that shouldn't matter - "Exception" should catch anything.
Cheers,
Shannon
I've got some code which raises or lowers (ie enables or disables) the
SIP on a PPC in order to allow text to be entered when the focus is in
particular controls (eg text boxes). The current scenario is that the
user checks a checkbox, which raises/enables the SIP and puts the focus
into a particular textbox. The problem occurs when the user *unchecks*
the checkbox - the CheckStateChanged event for this lowers/disables the
SIP, but for some reason an exception is being thrown here. So I
surrounded the call to "inputPanel.Enabled = false;" with a try/catch
clause, which catches the exception and displays a MessageBox for
debugging purposes (so I know that the exception is being caught), but
then the MessageBox immediately vanishes (before any user interaction)
and the entire application exits! Am I missing something here? Isn't the
point of exception handling that it allows the software to *handle* the
exception when it occurs instead of allowing it to ascend up through the
call stack until the runtime terminates the process?
FWIW, the particular block of code looks like this:
try
{
this.inputPanel.Enabled = false;
}
catch (Exception e)
{
MessageBox.Show("Exception disabling SIP: " + e.Message);
}
Oh, and I don't get time to even read the output of e.Message before the
process is killed, so I'm not sure what type of Exception is being
thrown. But that shouldn't matter - "Exception" should catch anything.
Cheers,
Shannon