How to hide a form temporarily when you open a 2nd form?

T

Todd Jaspers

Hey guys,

I've got a MAIN form, which I have a series of navigational buttons on.
When I open a secondary form from that form, I'd like to be able to HIDE the
original form. The reason is, if the user wants to minimize the application
so that he / she can then do something else, I don't want them to immediately
see the original form.

On the other hand, when they exit from the 2nd form, I'd like for the
original form (the MAIN screen) to re-appear.

How can I do this?


Any ideas?


Thanks!
 
C

Ciaran O''Donnell

You could put something like this in the event handler:
//assuming this is the main form
this.Hide();
newform.ShowDialog(this);
this.Show();


That would hide the form while the 2nd is show. However, passing the main
form as the owner of the dialog should keep it shown above it.

If you dont want the 2nd form to be model, you would need to handle the
OnClosed event to show the main form.

HTH
 
T

Todd Jaspers

OMG, you're so awesome. Thank you!!!

Ciaran O''Donnell said:
You could put something like this in the event handler:
//assuming this is the main form
this.Hide();
newform.ShowDialog(this);
this.Show();


That would hide the form while the 2nd is show. However, passing the main
form as the owner of the dialog should keep it shown above it.

If you dont want the 2nd form to be model, you would need to handle the
OnClosed event to show the main form.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top