I'm using two Calendar date/time pickers to set a date range that is used for a SQL DB lookup. I only want the user to be able to select a date that is no more then 30 days from the current date/time in both date pickers. The max date is always today's date/time.
I can get the calendar to only allow 30 days from today but it produces an error if I choose the last available date (today - 1 month).
The code that I am using is as follows:
I can get the calendar to only allow 30 days from today but it produces an error if I choose the last available date (today - 1 month).
The code that I am using is as follows:
Protected Sub RadDateTimePicker1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadDateTimePicker1.Load | |
Dim dt As New DateTime() | |
dt = RadDateTimePicker1.MinDate | |
dt = Date.Now.AddMonths(-1) | |
RadDateTimePicker1.MinDate = dt | |
RadDateTimePicker1.MaxDate = Date.Now | |
End Sub | |
Protected Sub RadDateTimePicker2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadDateTimePicker1.Load | |
Dim dt As New DateTime() | |
dt = RadDateTimePicker2.MinDate | |
dt = Date.Now.AddMonths(-1) | |
RadDateTimePicker2.MinDate = dt | |
RadDateTimePicker2.MaxDate = Date.Now | |
End Sub |
Any suggestions on how to prevent the error icon (triangle) and only allow 30 days from the current date/time?
Thanks,
Joe