Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have table in database with some dates. I need to display these dates in MonthCalendar with bold font. I want to select needed records from database when user scrolls calendar, but there is no such event in this control. Any advices?
Posted
Updated 3-Dec-12 19:11pm
v2
Comments
Programm3r 4-Dec-12 3:06am    
Hi - you mentioned that there are no events that notifies you of a date being scrolled? So the MonthCalendar.DateChanged Event doesn't notify you at all? Is this the case?
[no name] 4-Dec-12 3:16am    
Not gettin' your question properly...
leptosomic 4-Dec-12 18:42pm    
I don't want to select all records from the table. I do GetDisplayRange at start and select dates between beginning and end of range. Indeed, why to select all records, if user can't see all of them in calendar at the moment? And what if there are too much records, how fast will it be? DateChanged doesn't fit, because it fires when user highlights dates, but user can scroll calendar without changing selected date. Assume, calendar displays september, october and november. A day selected in september, then user scrolls calendar to left, now we see august, september and october, and a day selected in september, date hasn't changed. And august haven't any bold dates, because it wasn't included in initial range, and program doesn't know, what it's time to select next portion of dates. Actually I need DisplayRangeChanged event.

May be I should use CalendarDimensions property and SelectionRange instead of GetDisplayRange.
something like this:
monthsDisplayed=CalendarDimensions.Width*CalendarDimensions.Height;
dateStart=SelectionRange.End.AddMonths(-monthsDisplayed);
dateEnd=SelectionRange.Start.AddMonths(monthsDisplayed);
and then select dates from datatable where dates between dateStart and dateEnd and on DateChanged recalculate this diapason and select next portion of data if diapason was increased. Just extending bounds of diapason in both sides such way that in worst case date will change early than user will see empty part of calendar.
leptosomic 4-Dec-12 18:51pm    
And excuse me for not so clear formulation of question and broken language. This is my first post in english, I need more practice :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900