vb2005 app drops behind to background after clicking OK msgbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a simple vb2005 app (for testing). It is just a simple winform with
one button that brings up a message box. When I invoke the app and click on
the button, the message box comes up OK. When I click a button on the
message box, the form and message box drop behind the IDE to the background.
The exe does the same thing. What can I do to keep the app from
dropping/falling to the background like that? Here is the code behind the
button.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Select Case MessageBox.Show("hello world from VB2005", "Testing",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button3, MessageBoxOptions.DefaultDesktopOnly, False)
Case Windows.Forms.DialogResult.Yes : MessageBox.Show("Yes")
Case Windows.Forms.DialogResult.No : MessageBox.Show("No")
Case Windows.Forms.DialogResult.Cancel : MessageBox.Show("Cancel")

End Select
End Sub

It is a very simple app, no imports no option strict, ...

Any suggestions appreciated.

Rich
 
I added a second button to the form which brings up a simpler message box -
just an OK message box. This one works correctly. I click the button on the
form - it brings up the OK messagebox. I click OK on this message box and
the message box disappears and the form stays in view. The first button on
the form brings up a message box with 3 buttons - Yes, No, Cancel. When I
click any of those buttons, the messagebox and the form fall behind the IDE
to the background. Why does this message box cause that behavior but the 2nd
message box works OK?
Here is the code for the 2nd button:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
MessageBox.Show("Greetings", "Greetings", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign, True)
End Sub
 
Back
Top