Y
yevgeny.pechenezhsky
I am receiving the following error while running my application:
------------------------------------------------------------------------------------------------
An unhandled exception of type 'System.ObjectDisposedException'
occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Panel".
------------------------------------------------------------------------------------------------
I am using Visual Studio .Net 2003 on the 1.1 Framework. Following is
the relevant C# source code which causes this error:
------------------------------------------------------------------------------------------------
private Form displayedScreen = null;
public void displayScreen(Form form, bool allowReload)
{
if (this.displayedScreen != null)
{
// do not replace the displayed form with the same type
if (allowReload && (this.displayedScreen.GetType() ==
form.GetType()))
return;
// destroy the old form through its stored reference
this.displayedScreen.Dispose();
}
// set the new form's properties and display it
form.TopLevel = false;
form.Parent = this.pnlContent;
form.Show();
// store a reference to the new form to be displayed
this.displayedScreen = form;
}
------------------------------------------------------------------------------------------------
An unhandled exception of type 'System.ObjectDisposedException'
occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Panel".
------------------------------------------------------------------------------------------------
I am using Visual Studio .Net 2003 on the 1.1 Framework. Following is
the relevant C# source code which causes this error:
------------------------------------------------------------------------------------------------
private Form displayedScreen = null;
public void displayScreen(Form form, bool allowReload)
{
if (this.displayedScreen != null)
{
// do not replace the displayed form with the same type
if (allowReload && (this.displayedScreen.GetType() ==
form.GetType()))
return;
// destroy the old form through its stored reference
this.displayedScreen.Dispose();
}
// set the new form's properties and display it
form.TopLevel = false;
form.Parent = this.pnlContent;
form.Show();
// store a reference to the new form to be displayed
this.displayedScreen = form;
}