Articles in this section
Category / Section

How to restrict the selected date in WinForms MonthCalendarAdv?

1 min read

Restrict the selected date

We can restrict the dates that are selected. If you want to allow the user to select only Mondays on the calendar, you can set Clickable property to false for other days except Monday using DateCellQueryInfo event handler.

C#

void monthCalendarAdv1_DateCellQueryInfo(object sender, DateCellQueryInfoEventArgs e)
{
   // if not Monday
   if (e.ColIndex != 2)
   {
      e.Style.Clickable = false;
      e.Style.Enabled= false;
   }
}

VB

Private Sub monthCalendarAdv1_DateCellQueryInfo(ByVal sender As Object, ByVal e As DateCellQueryInfoEventArgs)
   '' if not Monday
   If e.ColIndex <> 2 Then
     e.Style.Clickable = False
     e.Style.Enabled= False
   End If
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