)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable the particular date in WinForms DateTimePicker (DateTimePickerAdv)?

Platform: WinForms |
Control: DateTimePickerAdv |
Published Date: December 11, 2014 |
Last Revised Date: November 15, 2019

Disable the particular date 

You can disable a particular date in DateTimePickerAdv by handling the DateCellQueryInfo event.

 

C#

void Calendar_DateCellQueryInfo(object sender, Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs e)
{
    // This event enables user to customize MonthCalenderAdv DateCells
    if (e.RowIndex == 3 && e.ColIndex > 6)
    {
         e.Style.BackColor = Color.Snow;
         e.Style.Enabled = false;             
    }
    else
    {
         // To set selectable Date cells BackColor
         e.Style.BackColor = Color.FromArgb(13, 134, 64);
    }
}

 

VB

Private Sub Calendar_DateCellQueryInfo(sender As Object, e As Syncfusion.Windows.Forms.Tools.DateCellQueryInfoEventArgs)
    ' This event enables user to customize MonthCalenderAdv DateCells
    If e.RowIndex = 3 AndAlso e.ColIndex > 6 Then
       e.Style.BackColor = Color.Snow
       e.Style.Enabled = False
    Else
       ' To set selectable Date cells BackColor
       e.Style.BackColor = Color.FromArgb(13, 134, 64)
    End If
End Sub

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/131842/datetimepicker695623093.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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
Live Chat Icon