Unhiding a form...

R

RSH

My form woes continue...I have a Parent form that hides itself when one if
it's child forms are spawned. My problem is that I need the child form to
unhide the parent form when it is being closed. I wired the closing even
already so I am trapping the event but I need to know what method to call to
unhide the Parent form:

on the Child Form:
this.ParentForm.UnHide???

Thanks!
Ron
 
M

Matt

RSH said:
My form woes continue...I have a Parent form that hides itself when one if
it's child forms are spawned. My problem is that I need the child form to
unhide the parent form when it is being closed. I wired the closing even
already so I am trapping the event but I need to know what method to call to
unhide the Parent form:

on the Child Form:
this.ParentForm.UnHide???

Thanks!
Ron

Hm.

this.ParentForm.Visible = true;

might work?

Matt
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

RSH said:
My form woes continue...I have a Parent form that hides itself when one if
it's child forms are spawned. My problem is that I need the child form to
unhide the parent form when it is being closed. I wired the closing even
already so I am trapping the event but I need to know what method to call
to unhide the Parent form:

on the Child Form:
this.ParentForm.UnHide???

How are you showing your child window?
If you use ShowDialog then it's easy :

void ShowChildForm()
{
this.Hide();
new ChildForm().ShowDialog();
this.Show();
}

Otherwise, just pass a reference to the child window.
 
R

Richard Blewett [DevelopMentor]

RSH said:
My form woes continue...I have a Parent form that hides itself when one if
it's child forms are spawned. My problem is that I need the child form to
unhide the parent form when it is being closed. I wired the closing even
already so I am trapping the event but I need to know what method to call
to unhide the Parent form:

on the Child Form:
this.ParentForm.UnHide???

Thanks!
Ron

well if the child is *really* a child window of the parent (child and parent
have very specific meanings in Windows) then

this.Parent.Show():

However, if by parent you mean "the form that had code that showed this
other form" then there is no specified relationship between the forms. You
need to pass a reference to the parent form to the clid in childs
constructor or maybe more decoupled, have an event on the child that the
praent subscribes to that the child raises when it closes.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
 
M

Matt

Ignacio said:
Hi,





Most probably not, see Richard post for a detailed description.

Teach me to just scan the post. I was assuming he knew what the
"ParentForm" was. You are quite correct.

Matt
 

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