Msgbox Appearing BEHIND application Form

  • Thread starter Thread starter Tappy Tibbons
  • Start date Start date
T

Tappy Tibbons

We have a weird problem, where we are popping up a msgbox, and
intermittently it is displaying BEHIND the main app form.

Basically, our form is up, we call a simple msgbox, and 97 times out of 100
it pops up exactly right. 3 times out of 100 it pops up behind the app. It
panics the user, as they can no longer click on the app. They must minimize
the app, click on the dialog, then restore the app.

We have tried "MsgBoxStyle.MsgBoxSetForeground" and
"MsgBoxStyle.ApplicationModal" to no avail...

VS2002, WinXP

Any ideas for workarounds or troubleshooting this one?

Thanks!
 
Hi,

Have you tried specifiying the Application Form as the owner of the
MessageBox, some of the overloads of MessageBox.Show accept a IWin32Window
owner parameter, you can pass the form in here.

Hope this helps

Chris Taylor
 
I thought I remembered there was a place to set an owner! But, i was using
the old MsgBox() vs. the MessageBox.Show().

I will try it, Thanks.

BTW - Any ideas on what internal differences there are, if any, between
msgbox() and MessageBox.Show()?
 
Hi,

Basically the MsgBox translates the VB6 like parameters into the relevant
MessageBox.Show parameters and calls MessageBox.Show. I confirmed this with
ILDASM.

Hope this helps

Chris Taylor
 
Back
Top