Problems using frm.show(this)

wakeup

New member
Joined
May 15, 2014
Messages
1
Programming Experience
5-10
In my program when I open a new form, I new to do "show(this)" ir order to send the parent to the new form, to ensure it is open in the same display (when multi monitoring) with the instruction CenterToParent.

Thats run, but the problem is when I do it the new window is always in front of the parent window.

I give you here an application example, in which after load Form2 from Form1, form1 is always back to form2, although it has the focus.
http://193.145.251.126/pnp/files/ivzRpJBad/TestVentanas.zip


Anyone knows how to solve it?

Thanks
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,140
Location
Sydney, Australia
Programming Experience
10+
That's because that's exactly what you're telling it to do. By passing 'this' to Show, you are saying that the new form is owned by the existing one. An owned form will always appear in front of its owner and it will minimise, restore and close when it's owner does too. One option could be to set the Owner to 'null' as soon as the new form opens.
 
Top Bottom