B
bryhhh
I have am still learning C#, so please bear with me.
I have an application that needs to open a second form, but I need the
second form to process message loops, whilst the original form also
continues to process message loops.
At the moment, my second form contains this code (and more irrelevant
code not listed)
public class SecondForm : System.Windows.Forms.Form
protected static void run()
{
Application.Run(SecondForm);
}
class SecondForm()
{
// Do something
}
}
From the first form, I'm attempting to open the second form simply
with
{
// This piece of code is already running in a second thread
// because it's doing something time consuming and I don't
// want the GUI to appear to hang.
SecondForm mySecondForm = new SecondForm();
mySecondForm.Show();
}
This opens the second form, but the second form doesn't process
message loops. When the SecondForm closes, I receive a
System.ObjectDisposedException on the line immediately after the
'mySecondForm.Show();' line.
Can anybody suggest what I'm doing wrong?
I have an application that needs to open a second form, but I need the
second form to process message loops, whilst the original form also
continues to process message loops.
At the moment, my second form contains this code (and more irrelevant
code not listed)
public class SecondForm : System.Windows.Forms.Form
protected static void run()
{
Application.Run(SecondForm);
}
class SecondForm()
{
// Do something
}
}
From the first form, I'm attempting to open the second form simply
with
{
// This piece of code is already running in a second thread
// because it's doing something time consuming and I don't
// want the GUI to appear to hang.
SecondForm mySecondForm = new SecondForm();
mySecondForm.Show();
}
This opens the second form, but the second form doesn't process
message loops. When the SecondForm closes, I receive a
System.ObjectDisposedException on the line immediately after the
'mySecondForm.Show();' line.
Can anybody suggest what I'm doing wrong?