C# Form does not come to front.

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
CDFA_IncAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
eternal_21Connect With a Mentor Commented:
You could use:

  ShowDialog();

or

  Show()
  TopMost = true;
0
 
CDFA_IncAuthor Commented:
I tried that it doesn't show up in front of the application you are using.
0
 
eternal_21Commented:
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
 
chintan_vaishyaCommented:
HI CDFA,

Try using BringToFront property of the Form.

Form.BringToFront();

Hope this helps you.
Good Luck.
Chintan.
0
 
TheAvengerCommented:
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
All Courses

From novice to tech pro — start learning today.