To set the default button you can use the SetDefaultButton method to the name of the button. The default button indicates which button is clicked when the C1TaskDialog control has focus and the user presses the ENTER key.
Complete the following steps to set the default button to an existing button:
The following code sets the default button:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load C1TaskDialog1.SetDefaultButton(C1CustomButton1) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
public Form1() { InitializeComponent(); c1TaskDialog1.SetDefaultButton(c1CustomButton1); } |
In this topic, you've set the default button to an existing button. If you run the application, you'll see that the button you indicated is set as the default button – if you open the dialog box and press the ENTER key, the button will be selected.