tags:

views:

1522

answers:

3

I want code for hiding multiple child forms in MDI. whenever i click child form it must be in front.other forms will automatically hide. How can i do this? pls any one reply me.

Thanks in advance

A: 

In Windows, there can be only form that is active at any point of time. So when user clicks on one form, if you set it to active, that should automatically accomplish what you are asking.

if 'frmObj' is your child form, just call frmObj.Activate() method on it.

You may also try to set the WindowState property (frmObj.WindowState) to maximized or whatever you like.

Sesh
To the person who voted this down, can you care to explain please?
Sesh
+1  A: 

If you watch the MdiChildActivate event, you hide all MDI children that are not active like this:

private void MDIMain_MdiChildActivate(Object sender, EventArgs e) {

   foreach(From f in this.MdiChildren)
   {
     if(this.ActiveMdiChild != f)
       f.Hide();
    }

}
scottm