Category / Section
How to disable the particular date in WinForms DateTimePicker (DateTimePickerAdv)?
1 min read
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: https://www.syncfusion.com/downloads/support/directtrac/131842/datetimepicker695623093.zip