Table of Contents

Class ExMessageBox

Namespace
ExControls
Assembly
ExControls.dll

Displays a message window, also known as a dialog box, which presents a message to the user.
It is a modal window, blocking other actions in the application until the user closes it.
A MessageBox can contain text, buttons, and symbols that inform and instruct the user.

public sealed class ExMessageBox
Inheritance
ExMessageBox
Inherited Members

Constructors

ExMessageBox()

Initializes a new instance of the ExMessageBox class.

public ExMessageBox()

ExMessageBox(string)

Initializes a new instance of the ExMessageBox class with text.

public ExMessageBox(string text)

Parameters

text string

text in MessageBox's message

ExMessageBox(string, string)

Initializes a new instance of the ExMessageBox class with text and caption.

public ExMessageBox(string text, string caption)

Parameters

text string

text in MessageBox's message

caption string

caption of the MessageBox

ExMessageBox(IWin32Window?)

Initializes a new instance of the ExMessageBox class with specified owner.

public ExMessageBox(IWin32Window? owner)

Parameters

owner IWin32Window

owner of this MessageBox

ExMessageBox(IWin32Window?, string)

Initializes a new instance of the ExMessageBox class with specified owner and text.

public ExMessageBox(IWin32Window? owner, string text)

Parameters

owner IWin32Window

owner of this MessageBox

text string

text in MessageBox's message

ExMessageBox(IWin32Window?, string, string)

Initializes a new instance of the ExMessageBox class with specified owner, text and caption.

public ExMessageBox(IWin32Window? owner, string text, string caption)

Parameters

owner IWin32Window

owner of this MessageBox

text string

text in MessageBox's message

caption string

caption of the MessageBox

Properties

ButtonAbortText

Gets or sets text of Abort button in MessageBox.

public static string ButtonAbortText { get; set; }

Property Value

string

ButtonCancelText

Gets or sets text of Cancel button in MessageBox.

public static string ButtonCancelText { get; set; }

Property Value

string

ButtonHelpText

Gets or sets text of Help button in MessageBox.

public static string ButtonHelpText { get; set; }

Property Value

string

ButtonIgnoreText

Gets or sets text of Ignore button in MessageBox.

public static string ButtonIgnoreText { get; set; }

Property Value

string

ButtonNoText

Gets or sets text of No button in MessageBox.

public static string ButtonNoText { get; set; }

Property Value

string

ButtonOKText

Gets or sets text of OK button in MessageBox.

public static string ButtonOKText { get; set; }

Property Value

string

ButtonRetryText

Gets or sets text of Retry button in MessageBox.

public static string ButtonRetryText { get; set; }

Property Value

string

ButtonYesText

Gets or sets text of Yes button in MessageBox.

public static string ButtonYesText { get; set; }

Property Value

string

Buttons

Gets or sets buttons visible in MessageBox.

public MessageBoxButtons Buttons { get; set; }

Property Value

MessageBoxButtons

Caption

Gets or sets the caption of the MessageBox.

public string Caption { get; set; }

Property Value

string

Countdown

Gets or sets an interval in seconds. After exceeding the limit the MessageBox closes itself

public int Countdown { get; set; }

Property Value

int

DefaultButton

Gets or sets default button in MessageBox.

public MessageBoxDefaultButton DefaultButton { get; set; }

Property Value

MessageBoxDefaultButton

Form

Gets form of this MessageBox.

public ExMessageBoxForm Form { get; }

Property Value

ExMessageBoxForm

Icon

Gets or sets the icon showing in the MessageBox.

public MessageBoxIcon Icon { get; set; }

Property Value

MessageBoxIcon

IconProvider

Gets or sets a function that supplies the image of the message box icon (e.g. icons of the application) for the icon type and the control that shows it; when it is null or returns null, the system stock icon is shown. The message box does not dispose the image.

public static Func<MessageBoxIcon, Control, Image?>? IconProvider { get; set; }

Property Value

Func<MessageBoxIcon, Control, Image>

Options

Gets or sets options for MessageBox.

public MessageBoxOptions Options { get; set; }

Property Value

MessageBoxOptions

Owner

Gets owner of this MessageBox.

public IWin32Window? Owner { get; }

Property Value

IWin32Window

ShowHelp

Gets or sets visibility of Help button in MessageBox.

public bool ShowHelp { get; set; }

Property Value

bool

Style

Gets or sets style of components in MessageBox.

public static ExMessageBoxStyle Style { get; set; }

Property Value

ExMessageBoxStyle

Text

Gets or sets the text associated with this control.

public string Text { get; set; }

Property Value

string

Methods

Show()

Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it.

public DialogResult Show()

Returns

DialogResult

One of the DialogResult values.

Exceptions

ArgumentException

when Form is null

Show(string, int)

Displays a message box with specified text.

public static DialogResult Show(string text, int countdown = -1)

Parameters

text string

text in MessageBox's message

countdown int

countdown in seconds before the default button is pressed; -1 = no countdown

Returns

DialogResult

the button the user pressed

Show(string, string, int)

Displays a message box with specified text and caption.

public static DialogResult Show(string text, string caption, int countdown = -1)

Parameters

text string
caption string
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, bool, int)

Displays a message box with specified text, caption, and style with Help Button.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
displayHelpButton bool
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, int)

Displays a message box with specified text, caption, style and Help file Path .

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, string, int)

Displays a message box with specified text, caption, style, Help file Path and keyword.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, string keyword, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
keyword string
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, HelpNavigator, int)

Displays a message box with specified text, caption, style, Help file Path and HelpNavigator.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
navigator HelpNavigator
countdown int

Returns

DialogResult

Show(string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, HelpNavigator, object, int)

Displays a message box with specified text, caption, style, Help file Path ,HelpNavigator and object.

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param, int countdown = -1)

Parameters

text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
navigator HelpNavigator
param object
countdown int

Returns

DialogResult

Show(IWin32Window, string, int)

Displays a message box with specified text.

public static DialogResult Show(IWin32Window owner, string text, int countdown = -1)

Parameters

owner IWin32Window
text string
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, int)

Displays a message box with specified text and caption.

public static DialogResult Show(IWin32Window owner, string text, string caption, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, int)

Displays a message box with specified text, caption, and style.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, int)

Displays a message box with specified text, caption, style and Help file Path for a IWin32Window.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, string, int)

Displays a message box with specified text, caption, style, Help file Path and keyword for a IWin32Window.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, string keyword, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
keyword string
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, HelpNavigator, int)

Displays a message box with specified text, caption, style, Help file Path and HelpNavigator for IWin32Window.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
navigator HelpNavigator
countdown int

Returns

DialogResult

Show(IWin32Window, string, string, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, string, HelpNavigator, object, int)

Displays a message box with specified text, caption, style, Help file Path ,HelpNavigator and object for a IWin32Window.

public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param, int countdown = -1)

Parameters

owner IWin32Window
text string
caption string
buttons MessageBoxButtons
icon MessageBoxIcon
defaultButton MessageBoxDefaultButton
options MessageBoxOptions
helpFilePath string
navigator HelpNavigator
param object
countdown int

Returns

DialogResult

Events

HelpRequested

Occurs when the user requests help for a control.

public event HelpEventHandler? HelpRequested

Event Type

HelpEventHandler