S
stumorgan
There is probably an extremely simple answer to this question and I'm
just being foolish.
I have a main form (let's say FormMain) which opens other forms (let's
say Form1, Form2). How do I keep those created forms, Form1 and Form2,
from closing when I close FormMain? Right now what I'm doing is
threading them by wrapping the Show method and in that threaded wrapper
I have a while loop that just does Application.DoEvents() as long as
the form hasn't been closed.
private void ShowForm() // this is the threaded function
this.Show();
while(!closed)
{
Application.DoEvents();
}
}
and in the form's Closed event I set closed = true.
It works just fine, but I feel like it's probably inefficient and I
think there has to be a better (and probably simpler) way of doing it.
Any ideas? Feel free to mock me for my stupidity.
just being foolish.
I have a main form (let's say FormMain) which opens other forms (let's
say Form1, Form2). How do I keep those created forms, Form1 and Form2,
from closing when I close FormMain? Right now what I'm doing is
threading them by wrapping the Show method and in that threaded wrapper
I have a while loop that just does Application.DoEvents() as long as
the form hasn't been closed.
private void ShowForm() // this is the threaded function
this.Show();
while(!closed)
{
Application.DoEvents();
}
}
and in the form's Closed event I set closed = true.
It works just fine, but I feel like it's probably inefficient and I
think there has to be a better (and probably simpler) way of doing it.
Any ideas? Feel free to mock me for my stupidity.