Skip to main content
All docs
V23.2

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

Displays an input box with the specified settings.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public static T? Show<T>(
    IWin32Window owner,
    string prompt,
    string title,
    T defaultResponse,
    XtraInputBox.Buttons buttons
)
    where T : struct

Parameters

Name Type Description
owner IWin32Window

The owner of this Input Box.

prompt String

The text string displayed above an editor.

title String

The title of this Input Box.

defaultResponse T

The initial editor value.

buttons XtraInputBox.Buttons

Specifies buttons displayed by this Input Box.

Type Parameters

Name Description
T

The type of a value requested from users.

Returns

Type Description
Nullable<T>

The value entered by a user, or null if nothing was entered.

Remarks

The code below illustrates how to invoke an XtraInputBox with a SpinEdit editor.

XtraInputBox.Show(this, "Enter a required amount", "Input Box", 5, Buttons.OKCancel);

You can also use XtraInputBoxArgs objects to pass required Input Box settings.

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