Kez
Kez

Reputation: 268

How can I make a form appear on top of all other windows?

How can I make a form appear on top of everything on the desktop, not just forms within my application. I have spent ages Googling but only found snippets for C++ and older versions of Visual Studio which no longer work. I know the answer is out there, I must be looking for the wrong thing.

Just to be clear - my project is created within Visual Studio 2012 and it is coded in Visual Basic.

Thanks in advance.

Upvotes: 6

Views: 44033

Answers (3)

R.Alonso
R.Alonso

Reputation: 1065

Me.TopMost = True

BUT in ACTIVATED (not in LOAD EVENT)

Private Sub frm_Activated(sender As Object, e As EventArgs) Handles Me.Activated

    Me.TopMost = True
End Sub

Upvotes: 0

user5351330
user5351330

Reputation: 11

Setting TopMost to True makes it obsure other windows permanently. I found if you make it True then False, you'll bring the Form to the top so it is visible, yet other Forms can go over if they are selected.

Upvotes: 1

SysDragon
SysDragon

Reputation: 9888

As Steve said, this work as long as your app is the only one using it:

Me.TopMost = True

Its a property found in forms. If you are executing this outside a form, use the name of the form, for example Form1.TopMost = True.

MSDN documentation and some info you may find interesting about trying to make a window to be in top of "Top-Most" Windows.

Upvotes: 12

Related Questions