VB.Net MessageBox.Show () moves my form back

I have an MDI application. When I show a message box using MessageBox.Show (), the entire application disappears behind all my open windows when I fire the message box.

The code does nothing special. In fact, here is the line that calls the message box from the MDI child form:

MessageBox.Show(String.Format("{0} saved successfully.", Me.BusinessUnitTypeName), "Save Successful", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Me.BusinessUnitTypeName () is a read only get property that returns a string, depending on the value of the member variable. There are no side effects in this property.

Any ideas?

+3
source share
3 answers

Remove the last parameter MessageBoxOptions.DefaultDesktopOnly.

From MSDN :

DefaultDesktopOnly , MessageBox . MessageBox, . . .

Windows csrss.exe! . Bart de Smet .

+5

MessageBoxOptions.DefaultDesktopOnly, .

DefaultDesktopOnly , " , .

+2

, . , . :

MessageBox.Show( "Hello").

Turns out there was a BindingSource.Endedit command before the MessageBox. BindingSource has not yet been connected to any controls, but it forced the window to change z-positions.

I am just including this note, since my search led me to this question, and I thought it might be useful for someone else.

0
source

Source: https://habr.com/ru/post/1697756/


All Articles