Results 1 to 7 of 7

Thread: [RESOLVED] Calendar control active day

  1. #1

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Resolved [RESOLVED] Calendar control active day

    Hi.... I'm using a calendar control and, if I click on an incorrect date, I want to put the focus back onto the date that was active before I clicked on the incorrect date. And I thought this would work...
    Code:
    calendarnumber = 1
    mycalendar.value = calendarnumber
    But it doesn't. So any help would be appreciated (I know about the monthview control but I just want to stick with this type of calendar for now).

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Calendar control active day

    What, in the context of what you're trying to do, is an 'incorrect date'?

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Calendar control active day

    Doesn't matter. MSCAL.OCX is part of Office and you can't redistribute it. It also isn't approved for use in VB6, VFP6, etc. programs much like the MS Forms 2.0 library.

  4. #4
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: Calendar control active day

    try something like this
    Code:
    Dim PreDay As Date
    
    Private Sub Form_Load()
    PreDay = 12
    Calendar1.Day = PreDay
    End Sub
    
    Private Sub Calendar1_Click()
    Calendar1.Day = PreDay
    End Sub
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  5. #5

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Re: Calendar control active day

    seenu_1st, I tried your code and it helped, thanks.

    Doogle, an incorrect date is a date that isn't within a particular range. In my program the range is from the first day of the current month up to and including the current day of the current month.

    I forgot to mention in my first post that I'm only trying to work with the current month's dates (my bad.) So really my question is, how do I put the focus back onto the previously active date in the current month, after I click on an incorrect date that is outside my range?

  6. #6

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Re: Calendar control active day

    After taking a break from this problem, I've decided to give it another go. So, does anyone out there have any suggestions? Thanks.

  7. #7

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Re: Calendar control active day

    Got it. The problem was that I was storing the previously active day not the previously active date. So instead of using this....

    Code:
    calendarnumber = format(mycalendar.value, "d")
    I simply should have been using....

    Code:
    calendarnumber = mycalendar.value
    Problem solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width