Category / Section
Is it possible not to load Dates after current DateTime in SfCalendar?
1 min read
In SfCalendar control, MaxDate property helps you to restrict loading date not falling greater than its specified date. This option will be helpful in this case.
The following code demonstrates the same.
Code Example: [C#]
private void Form1_Load1(object sender, EventArgs e) { // Set the MaxDate with Date and Time. this.sfCalendar.MaxDate = new System.DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 0, 0); }
Code Example: [VB]
Private Sub Form1_Load1(ByVal sender As Object, ByVal e As EventArgs) ‘Set the MaxDate with Date and Time. Me.sfCalendar.MaxDate = New Date(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 0, 0)End Sub
Screenshot:
Sample
C#: SfCalendar_C#
VB: SfCalendar_VB