bwgc Posted February 11, 2004 Posted February 11, 2004 Trying to refresh the MonthCalendar control after programmatically changing the SelectionRange with the following properties: monthCalendar1.SelectionStart=FirstDay.Value; monthCalendar1.SelectionEnd=LastDay.Value; Have tried .Refresh() & .Update() - neither seems to update the Calendar displayed selected range? Anybody? Quote
cdotnet Posted September 10, 2004 Posted September 10, 2004 Month Calendar update solution and SelectionRange is rubbish hi, the solution is to tell the control to refresh itself, this is not done automatically as i guess it would flicker. try: monthCalendarName.UpdateBoldedDates(); another problem with calendar is detailed here you may come across it: my .net remoting application client winform needs to select and highlight dates, to get to these dates once highlighted we can use SelectionRange but we cannot simply do a monthCalendar.AddBoldedDate(monthCalendar.SelectionRange) which would be great, it seems obfuscated and less than useful considering the implementation it could have been (as above.) Here was my solution, its commented so i wont repleat myself. Hope this helps all confused by the SelectionRange ! c. //get start of selection DateTime startDate = monthCalendarMain.SelectionStart.Date; //get end of selection DateTime endDate = monthCalendarMain.SelectionEnd.Date; //timespan calculated from end date minus start date TimeSpan timeSpan = endDate.Subtract(startDate); //create a dateTime array to hold our new dates for bolding DateTime [] selectedDates = new DateTime [timeSpan.Days + 1]; //loop for how ever many dates there are in calendar selection for (int index = 0; index < selectedDates.Length; index++) { //for each one set it to bold, this preserves the existing selections. monthCalendarMain.AddBoldedDate(startDate.AddDays(Convert.ToDouble(index))); } //show user the changes monthCalendarMain.UpdateBoldedDates(); -------------------------------- From: craig soens-hughes Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.