Articles in this section
Category / Section

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

3 mins read

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


Conclusion

I hope you enjoyed learning about how to Auto-Select the initial field in the WinForms DateTimePickerAdv.

You can refer to our WinForms DateTimePicker feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. 

You can also explore our  WinForms DateTimePicker example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied