mmm... Here is a snippet from a little test program:
public partial class MainMdi : Form
{
public MainMdi()
{
InitializeComponent();
view2 = null;
}
private View2 view2;
private void view2ToolStripMenuItem_Click(object sender, EventArgs e)
{
view2 = new View2();
view2.MdiParent = this;
view2.Show();
}
private void activateToolStripMenuItem_Click(object sender, EventArgs e)
{
if (view2 != null) ActivateMdiChild(view2);
}
}
(there are other View1, etc. that the program may open)
However, in this little program it works! In my actual project a similar code does NOT, and I now found that it works by adding the following in View2:
private void View2_Activated(object sender, EventArgs e)
{
this.BringToFront();
}
So, from the point of view of my project the issue is fixed - it remains a mystery for me to understand why I have different behavior in the actual project vs. the testing one.
Thanks