Solved

C# Form does not come to front.

Posted on 2004-09-22
5
935 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
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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