Open Form Problem
-
This code doesn't seam to work, it opens both as planned, but the frmCreate opens for 1/4 second or so, help please. The code:
private void mnuLogin_Click(object sender, System.EventArgs e) { Form openform = new frmCreate(); this.Close(); openform.Show(); }
-
This code doesn't seam to work, it opens both as planned, but the frmCreate opens for 1/4 second or so, help please. The code:
private void mnuLogin_Click(object sender, System.EventArgs e) { Form openform = new frmCreate(); this.Close(); openform.Show(); }
Of course it does! You closed the form (this) that is the only thing holding a reference to the new form you created. If Form1 creates Form2 and show it, then Form1 closes, Form2 is going to close it since nothing else is holding a reference to Form2. You can't "transfer" control of your application from form to form to form. You have to have a "parent" form that creates your other forms to keep their references alive. Those "child" forms can have their own "child" forms, and so on down the line. It'll look like a hierarchy when your done.
Startup Form | +-------+-------+ | | Form2 Form3 |
+----+----+
| |
Form4 Form5In this example, if you Close Form2, Forms4 and 5 are going to vanish too, because Form2 created and was holding the references for 4 and 5. In your code, you did just that. Your (this) form created a new form object called frmCreate, then killed itself, taking the newly created form with it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Of course it does! You closed the form (this) that is the only thing holding a reference to the new form you created. If Form1 creates Form2 and show it, then Form1 closes, Form2 is going to close it since nothing else is holding a reference to Form2. You can't "transfer" control of your application from form to form to form. You have to have a "parent" form that creates your other forms to keep their references alive. Those "child" forms can have their own "child" forms, and so on down the line. It'll look like a hierarchy when your done.
Startup Form | +-------+-------+ | | Form2 Form3 |
+----+----+
| |
Form4 Form5In this example, if you Close Form2, Forms4 and 5 are going to vanish too, because Form2 created and was holding the references for 4 and 5. In your code, you did just that. Your (this) form created a new form object called frmCreate, then killed itself, taking the newly created form with it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
How do I HIDE the form or something so frmCreate can be seen?
-
How do I HIDE the form or something so frmCreate can be seen?
-
How do I HIDE the form or something so frmCreate can be seen?
You don't look through the Intellisense list much, do you? You just said it yourself -> this.Hide()[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You don't look through the Intellisense list much, do you? You just said it yourself -> this.Hide()[^] RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
I said that as I found it in the list lol.