-
September 22nd, 2014, 05:54 AM
#1
Ensure that MessageBox is ALWAYS on Top
Firstly, I am using Visual Studio 2013
I have been looking for a way to ensure that the Message Box is ALWAYS on top and finally came up with this after the usual going round in circles
Code:
Private Sub frmTopmost_Load( sender As Object, e As EventArgs) Handles MyBase.Load
Me.TopMost = True
End Sub
frmTopmost.Show
frmTopmost.Hide
MessageBox.Show(frmTopmost, "I am always on top!")
This works well (frmTopmost is just a minmal dummy form) but offends my sense of style - is there a tidier way?
Edit:
I also would like to extend this to cover "Yes, No and Cancel" message boxes but cannot seem to be able to do that ...
Last edited by wavering; September 22nd, 2014 at 06:10 AM.
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
-
September 22nd, 2014, 11:43 AM
#2
Re: Ensure that MessageBox is ALWAYS on Top
Hi,
Use can use the old VB6 style Msgbox. try
MsgBox("Always on Top!", MsgBoxStyle.SystemModal, "On Top")
SystemModal keeps it on top.
Curt
-
September 23rd, 2014, 01:35 AM
#3
Re: Ensure that MessageBox is ALWAYS on Top
Originally Posted by curt_c
... MsgBox("Always on Top!", MsgBoxStyle.SystemModal, "On Top")
Brilliant! There are lots of requestes for this on the web and lots of people saying "it can't be done"
Many thanks -- tested and it works
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|