Articles in this section
Category / Section

How to retrieve selected date in DateTimePickerAdv?

1 min read

In DateTimePickerAdv, the selected value can be retrieved by following below steps.

 

  1. The date selection of the calendar popup can be detected by handling the event named “DateSelected” of the Calendar property in DateTimePickerAdv.
  2. The selected value can be retrieved by using the property named “Value” in DateTimePickerAdv.

 

The following code example demonstrates the same.

C#

//Occurs on user makes the date selection.
this.dateTimePickerAdv1.Calendar.DateSelected += Calendar_DateSelected;
 
void Calendar_DateSelected(object sender, EventArgs e)
{
    label1.Text = this.dateTimePickerAdv1.Value.ToString();
}

 

VB

'Occurs on user makes the date selection.
AddHandler Me.dateTimePickerAdv1.Calendar.DateSelected, AddressOf Calendar_DateSelected
 
Private Sub Calendar_DateSelected(ByVal sender As Object, ByVal e As EventArgs)
    label1.Text = Me.dateTimePickerAdv1.Value.ToString()
End Sub

 

Note:

The DateSelected event will be raised when selecting the date using the mouse click.

 

Showing selected value

Figure 1: The selected value of the DateTimePickerAdv.

Sample Links:

C#: DateTimePickerAdv_SelectedValue_C#

VB: DateTimePickerAdv_SelectedValue_VB

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