Back to Devexpress

XtraBaseArgs.DefaultButtonIndex Property

windowsforms-devexpress-dot-xtraeditors-dot-xtrabaseargs.md

latest2.2 KB
Original Source

XtraBaseArgs.DefaultButtonIndex Property

Gets or sets the index of a button from the Buttons collection that is a default button. A default button is initially focused and is considered clicked when user presses Enter or the auto-close timer expires (see AutoCloseOptions).

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public int DefaultButtonIndex { get; set; }
vb
Public Property DefaultButtonIndex As Integer

Property Value

TypeDescription
Int32

The index of a default button.

|

Remarks

The code below shows the XtraInputBox with “OK”, “Cancel” and “Retry” buttons. The “Retry” button is a default button - if a user presses Enter when the input box is shown, the input box closes and returns DialogResult.Retry.

csharp
XtraInputBoxArgs xia = new XtraInputBoxArgs();
(xia as XtraBaseArgs).Buttons = new DialogResult[] {
    DialogResult.OK, DialogResult.Cancel, DialogResult.Retry };
xia.DefaultButtonIndex = 2;
xia.Caption = "User not found. Enter a valid user name.";
XtraInputBox.Show(xia);
vb
Dim xia As New XtraInputBoxArgs()
TryCast(xia, XtraBaseArgs).Buttons = New DialogResult() {
    DialogResult.OK, DialogResult.Cancel, DialogResult.Retry }
xia.DefaultButtonIndex = 2
xia.Caption = "User not found. Enter a valid user name."
XtraInputBox.Show(xia)

See Also

XtraBaseArgs Class

XtraBaseArgs Members

DevExpress.XtraEditors Namespace