How to navigate to current date in DateTimePickerAdv ? in Windows Forms DateTimePickerAdv(Classic)
3 Sep 2020 / 1 minute to read
In DateTimePicker, we can navigate to current date by using the NavigateToCurrentDate method.
For example, it is possible to select current date on Enter key press and the following code illustrates the same.
void dateTimePickerAdv1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
// On pressing Enter key, date time picker navigates to current date.
if(e.KeyData== Keys.Enter)
this.dateTimePickerAdv1.NavigateToCurrentDate(true);
}
Private Sub dateTimePickerAdv1_PreviewKeyDown(ByVal sender As Object, ByVal e As PreviewKeyDownEventArgs)
' On pressing Enter key, date time picker navigates to current date.
If e.KeyData= Keys.Enter Then
Me.dateTimePickerAdv1.NavigateToCurrentDate(True)
End If
End Sub
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page