I have a piece of code that throws an exception and error after running for a second time. Here it is:
static Form Window = new Form();
static public void Configuration()
{
Window.Height = 800;
Window.Width = 800;
Window.Text = "Homework";
Window.Paint += Window_Paint;
Window.Show();
}
This code is inside a class and it throws an exception at "Window.Show();" saying that it:
ObjectDisposedException: Cannot access a disposed object.
Object name: 'Form'.
Please suggest a way that I can fix this so that it doesn't happen again.