Ben
Ben

Reputation: 2523

TopMost property not working

I have a form that when I check a box (Duplicate #), a form pops up (CableID_DuplicateView), and I want it to remain ontop until the checkbox is unchecked. However this isn't happening.

I have set the TopMost property to true both dynamically and statically;

this.TopMost = true;
this.TopMost = Checkbox.Checked;

But if I click on anything on the previous form, it gets shoved to the back.

enter image description here

How can I keep it ontop?

Note: I want the other form to still be accessible beneath the top form. And yes, this is an Mdi application, does that make a difference on the TopMost property?

Upvotes: 1

Views: 2391

Answers (3)

termigrator
termigrator

Reputation: 159

This worked for my similar problem:

try

yourTopForm.TopLevel=true;
yourTopForm.TopMost=true;
yourTopForm.Show(this);

The overloaded Show(this) funcition to show the form is the important part.

Upvotes: 2

W0lfw00ds
W0lfw00ds

Reputation: 2096

It is impossible to make the windows stay on top in MDI system. You can try to activate the windows, so they pop on the top, but this makes only more harm to other actions. I wouldn't recommend trying that. There is just no working way to make some window TopMost in MDI configuration.

Upvotes: 0

Xela
Xela

Reputation: 2382

Pass your parent form into the Show method of your Top Most form.

Upvotes: 0

Related Questions