bring form to top on notify icon click

ethicalhacker

Well-known member
Joined
Apr 22, 2007
Messages
142
Location
Delhi,India
Programming Experience
5-10
i want that when the notify icon is clicked the form is maximized and activated i.e brought to the front. As of now the form maximises in the background behind all windows.
 
Have you tried the Activate method? (you forgot?)
 
Unfortunately this does not always work in .NET 2.0. It will activate the form in the context of the application but will not usually bring said form to the front in the context of all open windows. Whether this is a bug or not, I don't know.

Here's how I do it:

VB.NET:
Dim OriginalState As Boolean = Me.TopMost
Me.TopMost = Not OriginalState
Me.TopMost = OriginalState

I do this to preserve and restore the form's original state. It will always bring the form to the front.
 
Did you call Show method also before you Activate it? Activate method invokes SetForegroundWindow, there are some special cases where it can't force window to foreground.
 
ya I used show before activate, The app is now on top on notify icon click

which are the special case you are talking about in which this wont work will it work if i also use show?
 
Back
Top