Articles in this section
Category / Section

How to configure WinForms DateTimePicker (DateTimePickerAdv) so that date entry is consistent with the grid cell?

1 min read

 

This is not supported by the DateTimePickerAdv, but this functionality can easily be achieved using the ComboBoxDropDown and the MonthCalendarAdv controls

Events

Set the popup control of the ComboBoxDropDown as MonthCalendrAdv and then handle the Leave event

C#

private void comboDropDown1_Leave(object sender, System.EventArgs e)
{
   DateTime dTime = DateTime.Parse(this.comboDropDown1.Text);
   this.monthCalendarAdv1.Value = dTime;
}

 

VB

Private Sub comboDropDown1_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
   Dim dTime As DateTime = DateTime.Parse(Me.comboDropDown1.Text)
   Me.monthCalendarAdv1.Value = dTime
End Sub

 

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