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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable or hide the previous and next month dates in WinForms DateTimePicker (DateTimePickerAdv)?

Platform: WinForms |
Control: DateTimePickerAdv

Disable or hide the previous and next month dates

By default, the trailing date (previous and next months' dates) is visible in the drop-down calendar of the DateTimePickerAdv. You can hide the trailing dates by setting forecolor of trailing dates to White in the DateCellQueryInfo event. The following code example demonstrates how to hide trailing dates in the drop-down calendar of the DateTimePickerAdv.


this.dateTimePickerAdv1.Calendar.DateCellQueryInfo += new DateCellQueryInfoEventHandler(Calendar_DateCellQueryInfo);
/// <summary>
/// Event to provide custom formatting for calendar cells.
/// </summary>
void Calendar_DateCellQueryInfo(object sender, DateCellQueryInfoEventArgs e)
    if (e.Style.TextColor == this.dateTimePickerAdv1.CalendarTrailingForeColor)
         // Hide the trailing dates 
         e.Style.Enabled = false;
         e.Style.TextColor = Color.White;


AddHandler dateTimePickerAdv1.Calendar.DateCellQueryInfo, AddressOf Calendar_DateCellQueryInfo
''' <summary>
'''Event to provide custom formatting for calendar cells.
''' </summary>
Private Sub Calendar_DateCellQueryInfo(ByVal sender As Object, ByVal e As DateCellQueryInfoEventArgs)
     If e.Style.TextColor = Me.dateTimePickerAdv1.CalendarTrailingForeColor Then
             'Hide the trailing dates 
 e.Style.Enabled = False
 e.Style.TextColor = Color.White
     End If
End Sub

Pop-up calendar without trailing dates



C#: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CS-1146374136

VB: http://www.syncfusion.com/downloads/support/directtrac/general/ze/VB-1476170831

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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

Live Chat Icon For mobile