Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - QUESTION: How to loop selection of dates
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

QUESTION: How to loop selection of dates

 Post Reply Post Reply
Author
Message
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Topic: QUESTION: How to loop selection of dates
    Posted: 25 January 2009 at 7:20am
Hi,
 
I'm totally new to this but for some of you this will be a piece of cake  
 
  1. I would like to get all selected dates from Selection in DatePicker. Looping Selection will return all dates (only start and/or end date) but how can I get the dates between start and end date?
  2. I would like to select days (for example 12-01-2009, 14-01-2009 and 19-01-2009) How to?

Thanks a lot

 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2009 at 9:21pm
Hi, Aaron, in current (12) version selection always means continious range
You can check in VB sample finction
Private Sub CalendarControl_SelectionChanged(ByVal SelType As XtremeCalendarControl.CalendarSelectionChanged)
    If SelType = xtpCalendarSelectionDays Then
        Debug.Print "SelectionChanged. Day(s)."
       
        If CalendarControl.ActiveView.Selection.IsValid Then
            Debug.Print CalendarControl.ActiveView.Selection.Begin
            Debug.Print CalendarControl.ActiveView.Selection.End
        End If
    End If
    If SelType = xtpCalendarSelectionEvents Then
        Debug.Print "SelectionChanged. Event(s)."
    End If
End Sub
 
 
 
 
which give you range: Selection.Begin and Selection.End - so you don't need smth between as it always in.
 
in Release 13 I add (in Month View only) discrete selection of days where you can have any set.
 
See snapshot: [unfortunately - Microsoft standard Month Picker (and similar CJ Month Picker) - used in DatePicker control - not supported discrete selection - so DatePicker at least now not reflect discrete selection inside Month View but user can use such temporary discrete selection e.g. to paste previously copied event into many different dates).
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2009 at 2:53am
Hi Mark,
 
I only want to use DatePicker control (not calendar control) for selecting dates. I would like to get the selected dates and save selection in a database and in a next session I would like to select the dates loading them from that database. Also I would like some days (which are special) to select with different backgrounds, so user easely sees what previously was selected.
 
I only want to present the dates, visual to the user, in for example a year, that's why I need this
 
Thanks a lot in advance
  
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2009 at 3:44am
Hi Aaron,
 
For your application, you can use this subroutine CalcSelectDays to put the list of the selected days in SelectDays().
  
Dim NbDays As Long
Dim SelectDays() As Date
 
Private Sub CalcSelectDays(NbDays as Long, SelectDays() as Date)
Dim i As Long
    NbDays = 0
    ReDim SelectDays(NbDays)
   
    With DatePicker1.Selection
    For i = 0 To .BlocksCount - 1
        AddSelectDays .Blocks(i).DateBegin, .Blocks(i).DateEnd, NbDays, SelectDays()
    Next
    End With
   
    For i = 1 To NbDays
        Debug.Print SelectDays(i)
    Next
End Sub
 
Private Sub AddSelectDays(DateBegin As Date, DateEnd As Date, Nb As Long, SelDays() As Date)
Dim Day As Date
    Day = DateBegin
    Do
        Nb = Nb + 1
        ReDim Preserve SelDays(Nb)
        SelDays(Nb) = Day
        Day = DateAdd("d", 1, Day)
    Loop Until Day > DateEnd
End Sub
 
I Hope it was usefull for you.
 
And thanks for your so many contributions that make this forum so living.
 
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2009 at 8:00am
 
You can use Descrete Selection Mode in DatePicker doing LeftClick holding Ctrl key pressed
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 26 January 2009 at 8:52am
Hi @Dentor
 
This is very helpfull  Thanks a lot for code snippet. This is how it should be in a forum: sharing knowlegde and willing to help others.
 
Thank you
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
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.125 seconds.