|
-
Apr 14th, 2004, 04:39 AM
#1
Thread Starter
Hyperactive Member
how do i stop creating lots of forms
i have a form (form1) which has a button, which when clicked opens a new form (form2).
My problem is that after clicking form1's button to open form2, i can go back to form1 and repeatedly click the button to create multiple instances of form2.
So my question is how do limit form1 to only create one instance of form2?
-
Apr 14th, 2004, 10:07 AM
#2
Addicted Member
have only one instead of form 2 created do not instanciate it in the button click
-
Apr 14th, 2004, 02:57 PM
#3
PowerPoster
http://abstractvb.com/code.asp?A=1096
Take the code from that above, and apply it to your form class code. It should do the trick.
-
Apr 14th, 2004, 03:02 PM
#4
PowerPoster
Sorry,
Forgot I was in the C# forum...
Here is a C# link for you:
http://www.c-sharpcorner.com/Code/20...tonPattern.asp
-
Apr 22nd, 2004, 08:12 AM
#5
Frenzied Member
Unless you don't want the user to get back to Form1 until Form2 is closed.
In that case just do a ShowDialog()
Code:
Form2 frm2 = new Form2();
frm2.ShowDialog();
-
Apr 23rd, 2004, 09:30 AM
#6
Probably closer to this actually 
Code:
Form2 frm2 = new Form2();
frm2.ShowDialog(Me);
or if you want a fancy one-shot...
Code:
x = (new Form2).ShowDialog(Me)
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|