Suppose I have a form that loads with TopMost = True. If I change the form
to TopMost = False will it immediately affect the form -- in other words is
TopMost dynamic? The reason I ask is that I want to disable TopMost when
I'm displaying a Msgbox (otherwise the message box appears behind my form).

Rob.

RE: TopMost - affects realtime? by info

info
Sat Aug 12 08:42:02 CDT 2006

"Rob R. Ainscough" wrote:

> Suppose I have a form that loads with TopMost = True. If I change the form
> to TopMost = False will it immediately affect the form -- in other words is
> TopMost dynamic? The reason I ask is that I want to disable TopMost when
> I'm displaying a Msgbox (otherwise the message box appears behind my form).

Yes, TopMost works immediately. If you want to ensure the other form you
are showing appears above the current form, you can:

Form form = new Form();
form.Text = "Test";
this.TopMost = false;
form.ShowDialog();
this.TopMost = true;

Note that if you show the other form with the Show() method instead of
ShowDialog(), then the "this.TopMost = true" line will execute immediately,
and your other form will not appear above your main form. In this case, the
only way to ensure the other form appears on top is to set its TopMost
property to true.

--
Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com