MsgBox on top?

Is there a way to tell a msgBox to stay on top of all other windows that are currently already open like a floating window does? Thanks!

Message boxes ARE modal.
You could also display another window (showModal), which would be very similar.

Sounds like you are miss using the MsgBox. It is modal and should halt your program’s execution until dismissed. Create your own window of type Global floating Window.

Yeah I know you can do that I was just trying to get around it.

I’m using the yes, no feature that is so easy to implement. I was just hoping there would be a way to just keep the window on top without having to create my own methods to handle the buttons. Like in the example from the LR.

Dim n As Integer n = MsgBox("Do you want to rebuild this mailbox?", 36) If n = 6 Then //user pressed Yes ElseIf n = 7 Then //user pressed No End If

[quote=191252:@Richard Summers]Message boxes ARE modal.
You could also display another window (showModal), which would be very similar.[/quote]

Is there a way using this to keep the window on top? Are you referring to using MessageDialog?

Not quite sure what you mean.
You could simply create a window called MessageWindow. Then display it - MessageWindow.ShowModal.
The window simply needs 2 buttons (yes and no), then put the appropriate code in each button.

This will stay on top until you close the window.

Yes but how do I assure that if the user clicks the window under the dialog the dialog will remain on top of all other windows?

ShowModal ensures that no other windows can become active until it is closed.

Ok thanks, I will certainly give that a try!

Just ensure your MessageWindow is set to either Modal Dialog or Movable Modal. (Document Windows will not be shown Modal).

The code you posted in your third post is also modal and prevents other windows from being activated until it closes - just like a MsgBox does.

Therefore, you have 3 options :slight_smile:

Once i changed my parent window to movable model instead of floating window the current code I had stayed on top. :slight_smile:

Glad to have helped :slight_smile: