Setting Date Selected to Date Other Than Today |
Post Reply |
Author | |
DDJJ
Senior Member Joined: 13 December 2004 Status: Offline Points: 143 |
Post Options
Thanks(0)
Posted: 19 October 2006 at 4:11pm |
Under certain circumstances when our users open the form with our calendar control, we want the first month shown in the DatePicker control to be September 2005 (this month has been pre-populated with events to display to the user).
We no not seem to be able to get the DatePicker to have any date selected other than Today when our form loads. We've been trying variations of the following to get the DatePicker to load with 9/1/2005 selected:
DatePicker1.ClearSelection
DatePicker1.EnsureVisible #9/1/2005# DatePicker1.SelectRange #9/1/2005#, #9/1/2005# DatePicker1.Select #9/1/2005# DatePicker1.EnsureVisibleSelection Nothing seems to work. We always end up with today being the selected date. Any ideas why?
Thanks, Dan
|
|
DDJJ
Senior Member Joined: 13 December 2004 Status: Offline Points: 143 |
Post Options
Thanks(0)
|
Also, the above code DOES get the DatePicker control to show the appropriate months, but the Calendar control always seems to display Today???
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Note that attaching DatePicker to Calendar affects only user's actions. Both controls do have their methods to change selection and active shown period, and you can use those methods to manipulate. Example which can be used on forms loading:
-- WBR, Serge |
|
DDJJ
Senior Member Joined: 13 December 2004 Status: Offline Points: 143 |
Post Options
Thanks(0)
|
Thanks Serge.
I've tried using variations of your code, with no luck.
I can get the form to load with (1) the appropriate day selected in the calendar control, (2) the appropriate months displayed in the data picker control, and (3) with the appropriate days in bold where events exist.
Although it looks like 9/1/2005 is already selected (and 9/1/2005 is bold, as it should be), the calendar control doesn't fill until I click on 9/1/2005 in the date picker??? If I check during the Form_Activate event, my code tells me that the "Selected" date is Today???
Dan
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Well, this looks to be a small bug in calendar. Date Picker should be updated inside AttachToCalendar call. To be fixed.
But for now to ensure this update just call AttachToCalendar before setting up Calendar1.ViewType or ShowDay (or change ViewType to ensure that). Example:
-- WBR, Serge |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |