Msgbox to the foreground????

Hi,

I've got a VB form in VS.NET 2005 which has a grid. When the user right-clicks on an item in the grid, I bring up a context menu. From there the operator chooses an option. Once the option is chosen, I ask that the operator confirms via a MsgBox similar to the following:

If MsgBox("Are you certain you wish to re-activate this product, MsgBoxStyle.Question + MsgBoxStyle.YesNo + MsgBoxStyle.MsgBoxSetForeground) = MsgBoxResult.No Then
Exit Sub
End If

The problem is that the message box does not appear in the foreground. I have to select another window from my task bar and then go back to the windows with the MsgBox to finally get the message box to appear.

Any help is appreciated.

Thank you.




Answer this question

Msgbox to the foreground????

  • SpecialTee

    Make your form the parent of the MessageBox, there's an overload for that, I believe.



  • Tdar

    Thanks for the response. I'm not really certain how to do that. Can you point me in the right direction

    Also, I have another form which works without any problems. It's the same type of form, that is, a grid, with a Context Menu and a Message box. Any ideas as to why this happens on one and not the other

    Thanks



  • Mark Simon

    Richard,

    Thanks for the reply. I added the .SystemModal and it worked. The weird thing about it is that on one computer there was no problem, on the other it would not show in the foreground!

    Weird ... at any rate, sorry it took so long to reply. Thanks again for your help. I really appreciate it.



  • micro_bug

    Not sure on that one, but try adding the "MsgBoxStyle.SystemModal" style to your list of flags and see if that does the trick.
  • Msgbox to the foreground????