October 15th, 2003, 11:55 AM
checking to see if a particular form is loaded
my solution has multiple forms/data forms. I reference between them,and can get them to popup/close down as needed.
If my form has a button, and the user clicks on it, the new form will show. However, if the user then clicks again on the button, a new instance of the same form appears.
Is there any way to check to see if the form is open/loaded/showing/anything but not loaded, and if it is just to gain focus to it again, rather than having a new instance?
Sounds really complicated, but im sure someone has come across this problem before.
Ideally, i'd want it where no matter how many times the button is pressed, only one new form appears.
Can you help?
October 15th, 2003, 01:33 PM
Followup to previous post.
I believe im after something called the "singleton class".
Anyone got any info?
October 15th, 2003, 03:08 PM
You could do what I do. You could place a bool variable called for example, isOpened in the top level form class, then check to see if its true or false before opening the form.
then to set isOpened back to false set an event for when the form is closed.
public bool isOpened;
if(isOpened == false)
WinForm1 aboutWindow = new WinForm1();
isOpened = true;
Last edited by CCDemonX; October 15th, 2003 at 03:15 PM.