Solved

C# Form does not come to front.

Posted on 2004-09-22
5
940 Views
Last Modified: 2008-02-26
I am writing a test messenger that runs minimized until a message comes in.  At that time, the form needs to show itself.  I am currently using the Show() method.  It works unless you are using word, excel, etc.  At that time, it shows itself but it is behind the word, excel, etc sheet.  How can I make it come to the front so it is the top level form?  Here is the brief code

Show();
WindowState = FormWindowState.Normal;                  

Thank you in advance,

Dean
0
Comment
Question by:CDFA_Inc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Accepted Solution

by:
eternal_21 earned 125 total points
ID: 12127859
You could use:

  ShowDialog();

or

  Show()
  TopMost = true;
0
 

Author Comment

by:CDFA_Inc
ID: 12127949
I tried that it doesn't show up in front of the application you are using.
0
 
LVL 10

Expert Comment

by:eternal_21
ID: 12128872
If you set the TopMost property to true, it certainly should show up on top of Excel (or any office applications).  Could you post some more of your code?  Is the form minimized already, or is it a 'new' form that you are displaying?
0
 
LVL 3

Expert Comment

by:chintan_vaishya
ID: 12130253
HI CDFA,

Try using BringToFront property of the Form.

Form.BringToFront();

Hope this helps you.
Good Luck.
Chintan.
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 12130939
Call the Activate() method of the form after you call the Show() method. This will just blink the form and will not bring it to the front, which is (I think) a better behaviour for a messenger because it will not interupt the user who, for example, is writing a letter in Word at that moment.

Here is what is written about the Activate() method:
Activating a form brings it to the front if this is the active application, or it flashes the window caption if this is not the active application. The form must be visible for this method to have any effect.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

622 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