How do I make sure only 1 child window opens?
So...
I've got a button on the Main window that opens up a child window. If you click on it multiple times, it opens up multiple windows. This is not a good thing for this app...
SO...
Is there an easy way to to the following:...
When you click on the open button, it opens a new window. If the window is already open in another spot, it will either close that window and open a new one, or simply relocate the existing window and place it where it would open.
Any siggestions???

GregPosted Feb 13, 2007, 4:19 AM
a. Create the instance of the form as global to the class.
b. On the button click, just call the object.Show().
If you wanted the functionality to close any existing form, and then re-open a fresh one, you could check if the object is currently displayed, then close it, then open it again?
Hence:
class MyClass
{
MyForm myForm1 = new MyForm();
void OnButtonClick()
{
// simple solution...
myForm1.Show();
}
}
Hope it helps.