MessageBox
In the System.Windows.Forms namespace you have the MessageBox class.
link - docs.microsoft.com/en-us/dotnet/api/system.windows.forms.messagebox?view=net-5.0
System.Windows.Forms.MessageBox.Show(
System.Windows.Forms.IWin32Window owner,
string text,
string caption, _
System.Windows.Forms.MessageBoxButtons buttons
System.Windows.Forms.MessageBoxIcon icon
System.Windows.Forms.MessageBoxDefaultButton defaultbutton
System.Windows.Forms.MessageBoxOptions options)
As System.Windows.Forms.DialogResult
MessageBoxButtons
AbortRetryIgnore | |
OK | |
OKCancel | |
RetryCancel | |
YesNo | |
YesNoCancel | |
MessageBoxIcon
None | The message box contain no symbols. |
Information | The message box contains a symbol consisting of a lowercase letter i in a circle. |
Asterisk | same as above |
Error | The message box contains a symbol consisting of white X in a circle with a red background. |
Hand | same as above |
Stop | same as above |
Exclamation | The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background. |
Warning | same as above |
Question | The message box contains a symbol consisting of a question mark in a circle. |
MessageBoxDefaultButton
Button1 | The first button on the message box is the default button. |
Button2 | The second button on the message box is the default button. |
Button3 | The third button on the message box is the default button. |
MessageBoxOptions
DefaultDesktopOnly | The message box is displayed on the active desktop. This constant is the same as ServiceNotification except that the system displays the message box only on the default desktop of the interactive window station DefaultDesktopOnly will cause the application that raised the MessageBox to lose focus. The MessageBox that is displayed will not use visual styles. For more information, see Rendering Controls with Visual Styles. |
RightAlign | The message box text is right-aligned. |
RtlReading | Specifies that the message box text is displayed with right to left reading order. |
ServiceNotification | The message box is displayed on the active desktop. The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer. |
DialogResult
Abort | |
Cancel | |
Ignore | |
No | |
None | |
OK | |
Retry | |
Yes | |
Microsoft.VisualBasic.MsgBox
Microsoft.VisualBasic.MsgBox(prompt As Object, _
[ buttons As Microsoft.VisualBasic.MsgBoxStyle = MsgBoxStyle.OKOnly ], _
[ title As Object = Nothing ], _
As Microsoft.VisualBasic.MsgBoxResult
When you have a look inside it is easy to see which method should be used to display a message box.
It appears that Microsoft.VisualBasic.MsgBox() does some exception check and then passes the call onto System.Windows.Forms.MessageBox.Show() this then does pretty much the same exception checking and the passes the call onto System.Windows.Forms.SafeNativeMethods.MessageBox() which is itself a wrapper for a win32 API call to user32.dll.
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext