XtraInputBox.Show<T>(IWin32Window, String, String, T) Method

Displays an input box with the specified title, prompt, and default response. You can also specify the returned value's type and the window that provides look and feel settings for the input box.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v20.1.dll

Declaration

public static T Show<T>(
    IWin32Window owner,
    string prompt,
    string title,
    T defaultResponse
)
    where T : struct
Public Shared Function Show(Of T As Structure)(
    owner As IWin32Window,
    prompt As String,
    title As String,
    defaultResponse As T
) As T

Parameters

Name Type Description
owner IWin32Window

An IWin32Window object that provides look and feel settings for the dialog box.

prompt String

The text above the editor.

title String

The text in the title bar.

defaultResponse T

The editor's default value.

Type Parameters

Name Description
T

The returned value's type.

Returns

Type Description
T

If OK or Yes is clicked, the editor's value converted to the specified type. Otherwise, the type's default value.

Examples

The code snippet below shows how to display a dialog box with custom settings.

using DevExpress.XtraEditors;

// Display an iput box with the specifiedx prompt, title, and default response.
XtraInputBox.Show("Enter a new value", "Change Settings", "Default");
XtraInputBox.Show(this, "Enter a new value", "Change Settings", "Default");

// Initialize a new XtraInputBoxArgs instance.
XtraInputBoxArgs args = new XtraInputBoxArgs();
// Specify settings.
args.Caption = "Shipping options";
args.Prompt = "Delivery date";
args.DefaultButtonIndex = 0;
// Initialize a new DateEdit instance.
DateEdit editor = new DateEdit();
// Specify settings.
editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI;
editor.Properties.Mask.EditMask = "MMMM d, yyyy";
// Assign the editor to the input box settings.
args.Editor = editor;
// Specify the editor's default value.
args.DefaultResponse = DateTime.Now.Date.AddDays(3);
// Display an input box and assign the result to a variable.
var result = XtraInputBox.Show(args);

// You can also use the generic method and specify the return value's type.
DateTime resultDateTime = XtraInputBox.Show<DateTime>(args);
See Also