Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Setting Date Selected to Date Other Than Today
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Setting Date Selected to Date Other Than Today

 Post Reply Post Reply
Author
Message
DDJJ View Drop Down
Senior Member
Senior Member


Joined: 13 December 2004
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDJJ Quote  Post ReplyReply Direct Link To This Post Topic: Setting Date Selected to Date Other Than Today
    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
 
Back to Top
DDJJ View Drop Down
Senior Member
Senior Member


Joined: 13 December 2004
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDJJ Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2006 at 4:13pm
Also, the above code DOES get the DatePicker control to show the appropriate months, but the Calendar control always seems to display Today???
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 22 October 2006 at 3:58pm
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:

DatePicker1.Select #9/1/2005#
DatePicker1.EnsureVisibleSelection
Calendar1.ActiveView.ShowDay #9/1/2005#
DatePicker1.AttachToCalendar Calendar1


--
WBR,
Serge
Back to Top
DDJJ View Drop Down
Senior Member
Senior Member


Joined: 13 December 2004
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDJJ Quote  Post ReplyReply Direct Link To This Post Posted: 23 October 2006 at 11:27am
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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2006 at 3:52am
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:

DatePicker1.AttachToCalendar Calendar1
 
Calendar1.ViewType = xtpCalendarWeekView
Calendar1.ViewType = xtpCalendarDayView

' Populate method should be used to read data and update calendar
Calendar1.Populate


--
WBR,
Serge
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.