Back to Devexpress

XtraMessageBox.Show(String) Method

windowsforms-devexpress-dot-xtraeditors-dot-xtramessagebox-dot-show-x28-system-dot-string-x29.md

latest7.3 KB
Original Source

XtraMessageBox.Show(String) Method

Displays the XtraMessageBox with the specified text.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public static DialogResult Show(
    string text
)
vb
Public Shared Function Show(
    text As String
) As DialogResult

Parameters

NameTypeDescription
textString

A string value that specifies the text to display in the message box.

|

Returns

TypeDescription
DialogResult

One of the DialogResult values.

|

Remarks

Default Parameters

ParameterDefault ValueProperty Name
CaptionString.EmptyCaption
ButtonsMessageBoxButtons.OKButtons
DefaultButtonIndex0DefaultButtonIndex
OwnernullOwner
IconMessageBoxIcon.NoneImageOptions

The following code snippet displays the XtraMessageBox with formatted text and a warning icon. If the user clicks Yes , the application closes the current form.

csharp
using DevExpress.XtraEditors;
using DevExpress.Utils;

if(XtraMessageBox.Show(
    "Do you want to close the <b>form</b>?", "Warning",
    MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
    DefaultBoolean.True) == DialogResult.Yes)
    this.Close();
vb
Imports DevExpress.XtraEditors
Imports DevExpress.Utils

If XtraMessageBox.Show("Do you want to close the <b>form</b>?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, DefaultBoolean.True) = DialogResult.Yes Then
    Me.Close()
End If

The following code snippets (auto-collected from DevExpress Examples) contain references to the Show(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-mvvm-best-practices/CS/DelegateCommands/SimpleCommandUserControl.cs#L24

csharp
{
    XtraMessageBox.Show("Hello! I'm running!");
});

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Export.cs#L50

csharp
DevExpress.XtraEditors.XtraMessageBox.SmartTextWrap = true;
DevExpress.XtraEditors.XtraMessageBox.Show(plainText);
#endregion #ExportRangeToPlainText

winforms-scheduler-sync-with-ews/CS/EWSSyncExample/ExchangeExampleForm.cs#L43

csharp
synchronizer.ExchangeToScheduler(schedulerControl1.DataStorage.Appointments, apt, true);
    XtraMessageBox.Show("Imported");
}

connect-winforms-grid-to-backend-using-middletier-server/CS/WinForms.Client/MainForm.cs#L95

csharp
catch(System.Security.SecurityException) {
    XtraMessageBox.Show("Modifying this data row is restricted for security reasons.");
}

connect-winforms-grid-to-webapi-service/CS/WinForms.Client/AuthForm.cs#L15

csharp
if(authToken == null) {
    XtraMessageBox.Show("Problem with authentificate");
    DialogResult = DialogResult.Cancel;

winforms-mvvm-best-practices/VB/DelegateCommands/SimpleCommandUserControl.vb#L21

vb
Dim command As New DelegateCommand(
    Sub() XtraMessageBox.Show("Hello! I'm running!"))
' UI binding for button

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Export.vb#L44

vb
DevExpress.XtraEditors.XtraMessageBox.SmartTextWrap = True
            DevExpress.XtraEditors.XtraMessageBox.Show(plainText)
#End Region ' #ExportRangeToPlainText

winforms-scheduler-sync-with-ews/VB/EWSSyncExample/ExchangeExampleForm.vb#L46

vb
Next apt
    XtraMessageBox.Show("Imported")
End Sub

connect-winforms-grid-to-backend-using-middletier-server/VB/WinForms.Client/MainForm.vb#L66

vb
Catch __unusedSecurityException1__ As System.Security.SecurityException
    XtraMessageBox.Show("Modifying this data row is restricted for security reasons.")
End Try

XAF_how-to-add-custom-buttons-actions-to-the-lookup-and-popup-windows/VB/WinSolution.Module.Win/PopupListViewController.vb#L31

vb
Private Sub actionInPopup_Execute(ByVal sender As Object, ByVal e As SimpleActionExecuteEventArgs)
    XtraMessageBox.Show(String.Format("Hello {0}!", e.CurrentObject))
End Sub

See Also

XtraMessageBox Class

XtraMessageBox Members

DevExpress.XtraEditors Namespace