HeaderPane
Main
Hide
Share Link
Print

Show Method, SftMessageBox Class

Displays a message box with the specified text.

Class: SftMessageBox
Namespace: Softelvdm.SftStyleNET
Assembly: Softelvdm.SftStyleNET

Syntax

public static DialogResult Show( string text );
public static DialogResult Show(
    string text,
    string caption );
public static DialogResult Show(
    IWin32Window owner,
    string text );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    bool displayHelpButton );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    string keyword );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    HelpNavigator navigator );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath );
public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    HelpNavigator navigator,
    object param );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    string keyword );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    HelpNavigator navigator );
public static DialogResult Show(
    IWin32Window owner,
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon,
    MessageBoxDefaultButton defaultButton,
    MessageBoxOptions options,
    string helpFilePath,
    HelpNavigator navigator,
    object param );
Public Shared Function Show( ByVal text As String ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal displayHelpButton As Boolean
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal keyword As String
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal navigator As HelpNavigator
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String
  ) As DialogResult
Public Shared Function Show(
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal navigator As HelpNavigator,
    ByVal param As Object
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal keyword As String
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal navigator As HelpNavigator
  ) As DialogResult
Public Shared Function Show(
    ByVal owner As IWin32Window,
    ByVal text As String,
    ByVal caption As String,
    ByVal buttons As MessageBoxButtons,
    ByVal icon As MessageBoxIcon,
    ByVal defaultButton As MessageBoxDefaultButton,
    ByVal options As MessageBoxOptions,
    ByVal helpFilePath As String,
    ByVal navigator As HelpNavigator,
    ByVal param As Object
  ) As DialogResult

Parameters

text

The text to display in the message box.

caption

The text to display in the title bar of the message box.

owner

The window that owns the message box.

buttons

The buttons to display in the message box.

icon

The icon to display in the message box.

defaultButton

The default button of the message box.

options

The display and association options of the message box.

displayHelpButton

True to show a Help button, which raises the HelpRequested event of the owner (the active form when no owner is given).

helpFilePath

The path and name of the help file shown by the Help button.

keyword

The topic of the help file the Help button opens, as with HelpNavigator.Topic.

navigator

The part of the help file the Help button shows.

param

The topic the Help button shows.

Return Value

One of the DialogResult values.

Comments

Displays a message box with the specified text.

Examples

C# View entire sample code

        private void sliderPrice_RangeChanged(object sender, EventArgs e) {
            ShowSliders();
        }

        private void ShowSliders() {
            labelSliders.Text = "Volume " + sliderVolume.Value + ", price range " + sliderPrice.LowerValue + " to " + sliderPrice.UpperValue;
        }

        // SftMessageBox takes the arguments of MessageBox.Show and returns the same results.
        private void buttonMessageBox_Click(object sender, EventArgs e) {
            DialogResult result = SftMessageBox.Show(this, "Do you want to save the changes to Order 1042 before closing?", "Orders",
                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
            labelResult.Text = "Message box: " + result;
        }

        private void buttonTaskDialog_Click(object sender, EventArgs e) {

VB.NET View entire sample code

    Private Sub SliderPrice_RangeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SliderPrice.RangeChanged
        ShowSliders()
    End Sub

    Private Sub ShowSliders()
        LabelSliders.Text = "Volume " + SliderVolume.Value.ToString() + ", price range " + SliderPrice.LowerValue.ToString() + " to " + SliderPrice.UpperValue.ToString()
    End Sub

    ' SftMessageBox takes the arguments of MessageBox.Show and returns the same results.
    Private Sub ButtonMessageBox_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonMessageBox.Click
        Dim result As DialogResult = SftMessageBox.Show(Me, "Do you want to save the changes to Order 1042 before closing?", "Orders",
            MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
        LabelResult.Text = "Message box: " + result.ToString()
    End Sub

    Private Sub ButtonTaskDialog_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonTaskDialog.Click

See Also SftMessageBox Class | Classes | SftStyle/NET 3.0