|
-
Dec 15th, 2006, 03:45 AM
#1
Hyperactive Member
Re: how to close form1 when i open form2?
 Originally Posted by fifo
It does not work. It will close both form because this code must be in Button_Click of form1 so that when you call This.Close() --> form1 will be Close with all of this code will be close, too.
Any ideas?
VB Code:
this.Hide();
Form2 newform = new Form2();
newform.Show();
This way the form's still open (in theory), however calling application.exit(); to close everything, will close that form too.
-
Dec 17th, 2006, 11:16 PM
#2
Re: how to close form1 when i open form2?
 Originally Posted by RudiVisser
VB Code:
this.Hide();
Form2 newform = new Form2();
newform.Show();
This way the form's still open (in theory), however calling application.exit(); to close everything, will close that form too.
the error with this code is that you should be declaring 'newform' with the type 'Form' not the type 'Form2:
Code:
this.Hide();
Form newform = new Form2();
newform.Show();
-
Dec 18th, 2006, 08:09 AM
#3
Hyperactive Member
Re: how to close form1 when i open form2?
 Originally Posted by tr333
the error with this code is that you should be declaring 'newform' with the type 'Form' not the type 'Form2:
Code:
this.Hide();
Form newform = new Form2();
newform.Show();
No, it's not.
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Dec 18th, 2006, 08:10 AM
#4
Hyperactive Member
Re: how to close form1 when i open form2?
 Originally Posted by RudiVisser
No, it's not.
Follow-up: Because there was no error..
» Twitter: @rudi_visser : Website: www.rudiv.se «
If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.
-
Dec 18th, 2006, 08:48 AM
#5
Re: how to close form1 when i open form2?
 Originally Posted by RudiVisser
Follow-up: Because there was no error.. 
(i thought i saw earlier in this thread that someone had an error with the code. didn't test it myself )
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
|