We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Auto-Select initial field in the DateTimePickerAdv once it is focused?

Platform: WinForms |
Control: DateTimePickerAdv |
Published Date: June 2, 2015 |
Last Revised Date: May 23, 2019

The null value of the DateTimePickerAdv is not set, by default. It can be set to DateTimePickerAdv by enabling the property, IsNullDate. When Date value is set as null date, the property NullModeKeyReset is set to ArrowKeys, by default.

 

The NullModeKeyReset property helps you define the keyboard navigation of the DateTimePickerAdv. When the date value is changed by keyboard navigation, the field of the DateTimePickerAdv changes continuously.

 

It is possible to AutoSelect the initial field or date value once it is focused by using its property named ResetSelectionOnFocus.

 

The following code example demonstrates the same.

C#

//Sets the selected value as Null.
this.dateTimePickerAdv1.IsNullDate = true;
//Gets or sets the keys that toggles off null date.
this.dateTimePickerAdv1.NullModeKeyReset = NullModeKeyReset.NumericKeys;
//Focuses the DateTimePickerAdv selection on the first field.
this.dateTimePickerAdv1.ResetSelectionOnFocus = true;

VB

'Sets the selected value as Null.
Me.dateTimePickerAdv1.IsNullDate = True
'Gets or sets the keys that toggles off null date.
Me.dateTimePickerAdv1.NullModeKeyReset = NullModeKeyReset.NumericKeys
'Focuses the DateTimePickerAdv selection on the first field.
Me.dateTimePickerAdv1.ResetSelectionOnFocus = True

 

Before selecting date

Figure 1: Before selecting the date

After selecting date

Figure 2: After selecting the date

Sample Links:

C#: http://www.syncfusion.com/downloads/support/directtrac/139429/ze/DateTimePickerAdv-2028970952

VB: http://www.syncfusion.com/downloads/support/directtrac/139429/ze/DateTimePickerAdv_VB-1618088184

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon