D
David Brunning
I have an application running on PocketPC which is controlled by a
while loop - child forms are opened using Reflection and before they
close raise an event to set the type of the next form to open. The
code for this control stuff is attached below.
In the child form that is opened if I raise an exception (After form
load as finished, i.e. wire up a button to an event handler and in
that handler throw a System.Exception.) this is correctly caught by
the code below but code execution doesn't stop on the ShowDialog()
line, instead the form which i am opening to report the exception is
being disposed immediately so that the user never sees it.
Any ideas?
/*CONTROL CODE SAMPLE*/
System.Windows.Forms.Form CurrentForm;
this.mNextFormType=typeof(Form1);
while (this.mNextFormType!=null)
{
try
{
//Open a form if there is a type specified.
CurrentForm=(System.Windows.Forms.Form)Activator.CreateInstance(this.mNextFormType);
this.mNextFormType=null;
CurrentForm.ShowDialog();
CurrentForm.Dispose();
}
catch (Exception exc)
{
//Display exception details
TestException TempForm=new TestException();
//Forms.ExceptionReport TempForm=new
CCSIT.KeystoneMobile.Forms.ExceptionReport(exc);
TempForm.Enabled=true;
TempForm.ShowDialog();
TempForm.Dispose();
}
}
while loop - child forms are opened using Reflection and before they
close raise an event to set the type of the next form to open. The
code for this control stuff is attached below.
In the child form that is opened if I raise an exception (After form
load as finished, i.e. wire up a button to an event handler and in
that handler throw a System.Exception.) this is correctly caught by
the code below but code execution doesn't stop on the ShowDialog()
line, instead the form which i am opening to report the exception is
being disposed immediately so that the user never sees it.
Any ideas?
/*CONTROL CODE SAMPLE*/
System.Windows.Forms.Form CurrentForm;
this.mNextFormType=typeof(Form1);
while (this.mNextFormType!=null)
{
try
{
//Open a form if there is a type specified.
CurrentForm=(System.Windows.Forms.Form)Activator.CreateInstance(this.mNextFormType);
this.mNextFormType=null;
CurrentForm.ShowDialog();
CurrentForm.Dispose();
}
catch (Exception exc)
{
//Display exception details
TestException TempForm=new TestException();
//Forms.ExceptionReport TempForm=new
CCSIT.KeystoneMobile.Forms.ExceptionReport(exc);
TempForm.Enabled=true;
TempForm.ShowDialog();
TempForm.Dispose();
}
}