Solved

Windows.Forms TopMost is lost

Posted on 2013-01-08
1
1,415 Views
Last Modified: 2013-02-25
Hello

I have a Windows.Forms Application "MyMainApp" (C# / .Net 4.0) which runs on Windows 7.

There is a second programm running at the same time, but the "MyMainApp" must always be visible and is started as TopMost.

I have the problem, that sometimes the "MyMainApp" disappears behind the second program “MySecProg”.
I found out that this happens, if another window “PopUpWindow” from a background process pops up as top most (f.e. Printing messages).

If I close the “PopUpWindow”, then "MyMainApp" stays behind the “MySecProg”. With Alt+Tab I can bring the focus to "MyMainApp" again and it comes to the front. It also stays at the front afterwards, what means that it is still TopMost.

What can I do, that "MyMainApp" does not disappear, if another window pops up?

Thanks for your help!!


FYI: This is a Question that was already answered. The accepted solution improofed the situation, but didn't solve it :-).

first solution:
this.Deactivate += new System.EventHandler(this.Form1_Deactivate);
private void Form1_Deactivate(object sender, EventArgs e)
        {
            this.Activate();
        }
0
Comment
Question by:ICSAutomation
1 Comment
 
LVL 25

Accepted Solution

by:
SStory earned 300 total points
ID: 38859715
http://stackoverflow.com/questions/683330/how-to-make-a-window-always-stay-on-top-in-net

Have you tried setting the .owner property as the above article suggests (last paragraph).
You need to make sure the on top app is owned by your other window, then you can keep it on top of your own window. There is no way to make a top most that is always above other windows that another app sets to topmost.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
insert image with its metadata into SQL server Database 3 87
LINQ - C# to VB convertion 12 46
Vb.net dynamic formulas in runtime 11 61
Error in script 11 44
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now