Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

  • 6 months later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...