When the user selects a date range, what method do I use to get the date range that has been selected?
Hi !!
I use SelectedDateRange on the UltraMonthViewMulti and I've a little problem.
When I select a date range, for exemple : 10 july to 15 july.
umvmFrmXX.CalendarInfo.SelectedDateRanges[0] has 10 to 15 july selected.
But If I select after that the 12 july, the SelectedDateRanges[0] is not changing (10 to 15 july selected) ???
How could I set the UltraMonthViewMulti in this case to have only 12 july selected and not the precedent range ?
thx
You would have to do something like walk backwards from the first day of the month until you hit the first day of the week, and include those days as well. Walk forward from the last day of the month until you hit last day of the week in the same manner.
That works great for selecting the current month. Ok, so now what if you want to know exactly which dates are being displayed to the user? For example, in outlook, if you bring up the current month the leading and trailing dates are also selected.
So, if you wanted to also include the leading and trailing dates in your SelectedDateRange, how would you interrogate the control to get those dates?
achinn said:How do you set the default to automatically select the entire month?
Example:
DateTime start = new DateTime( DateTime.Today.Year, DateTime.Today.Month, 1 );int daysInMonth = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetDaysInMonth( DateTime.Today.Year, DateTime.Today.Month );DateTime end = new DateTime( DateTime.Today.Year, DateTime.Today.Month, daysInMonth );this.calendarInfo.SelectedDateRanges.Add(start, end, true );
Ok, thank you....now what about setting the entire month to automatically be selected when the calendar comes up. In Outlook when you scroll to the next month, it also automatically selects the next month as the selected date range.
How do you set the default to automatically select the entire month? BTW, you've been very helpful.