Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Forms
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 3-Dec-12 20:09pm
Edited 3-Dec-12 20:11pm
v2
Comments
Programm3r at 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?
Krunal Rohit at 4-Dec-12 3:16am
   
Not gettin' your question properly...
leptosomic at 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 at 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)

  Print Answers RSS
0 OriginalGriff 400
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 245
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100