I have a main form (Form1) which opens a second form (Form2) when a button
is clicked. Form2 has .FormBorderStyle set to FixedSingle.
Form2 contains two buttons, one which unpins it from Form1 by setting
..ShowInTaskBar to true,
and setting .Owner to false. The other buttons click event reverses, this
by setting .Owner to the
form1 instance, and .ShowIntTaskBar to false.
This all works fine, with Form2appearing in the taskbar and the alt tab list
as expected.
The problem is that Form2 also contains a user control, who's Load event is
fired each time either button is clicked.
This problem is triggered by the change to the .ShowInTaskBar property, not
the .Owner property.
The load event of the hosted form is not triggered, just any hosted user
controls.
I have two questions...
1. Is this expected behavior. ( i can find no mention of this anywhere )
2. Is there a way to prevent this from occurring other than resorting to
setting a global flag which can be tested in
each user controls load event. In reality I have lots of user controls, so
this is not a very appealing option.
Any help or insight would be greatly appreciated.
Cheers.