CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Aug 2010
    Posts
    47

    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?

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
  •  





Click Here to Expand Forum to Full Width

Featured