Results 1 to 5 of 5

Thread: MS Calendar Control doesn't select date corectly frequently

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    433

    MS Calendar Control doesn't select date corectly frequently

    I'm using Microsoft Calendar Control(MSCal.ocx)
    In most case works fine but sometimes it doesn't return selected date.
    For example, form1 loads form2 which has Calendar control.
    And I use global Date type variable, gdCalendarDate.
    The VB6SP6 doesn't be installed in my PC for some reason.
    Is there any problem in MSCal.ocx VB6 version?
    Code:
        
        'Form1
        Private Sub cmdCalendar_Click()
            gdCalendarDate = CDate(txtDate.Text)
            frmCalendar.Show vbModal
            txtDate.Text = Format(gdCalendarDate, "mm/dd/yyyy")
        End Sub
    
        'Form2
        Private Sub Form_Load()
            Me.Calendar1.Value = gdCalendarDate
        End Sub
        
        Private Sub cmdOK_Click()
            gdCalendarDate = Me.Calendar1.Value
            Unload Me
        End Sub
    Can anybody give me some advice?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MS Calendar Control doesn't select date corectly frequently

    That library and control is part of MS Office. You don't want to use it in a VB6 program unless you are writing a DLL or OCX to be used from Office.

    Maybe you want the MonthView control that does come with VB6?

  3. #3
    Hyperactive Member
    Join Date
    Mar 2018
    Posts
    460

    Re: MS Calendar Control doesn't select date corectly frequently

    the file seems to be part of office and there are some questions about the legality of distributing the file yourself. we had so many issues we wrote our own user control to replace it and I suggest you do the same (or find one that has already been written)

  4. #4
    Frenzied Member
    Join Date
    Feb 2015
    Posts
    1,025

    Re: MS Calendar Control doesn't select date corectly frequently

    @jdy0803

    As the others have said, you shouldn't really be using mscal.ocx in VB6. It was provided for Office/Access and legally isn't available for VB6 use. But many do use it in VB6.
    It should work OK but can be problematical. I'd make sure you have at least SP5 installed.

    As others have said, it would be better to replace it. The VB6 MonthView control would be suitable and Krool's Common Controls (in the Codebank on this site) have a MonthView replacement.

    The DTPicker control is another option.
    Last edited by VB6 Programming; May 16th, 2019 at 02:35 PM.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MS Calendar Control doesn't select date corectly frequently

    It has a few landmines in it as well:

    Microsoft Calendar Control 10.0 and later versions use an incorrect value for the FirstDay property

    Symptoms

    In Microsoft Access, an incorrect day is displayed for the first day of the Calendar Control. This problem occurs when you insert a Microsoft Calendar Control 10.0 or a later version into a form or into a report, and then you set the FirstDay property of the Calendar Control by using Microsoft Visual Basic for Applications (VBA) intrinsic constants.

    For example, you set the FirstDay property of the Calendar Control to vbMonday or to vbTuesday. When you set the FirstDay property of the Calendar Control to vbTuesday, the calendar uses Wednesday as the first day of the week.

    Note When you use the earlier versions of Calendar Control, you can set the FirstDay property correctly.
    The control fell away from VB standards when MS Office tried to become more self-globalizing in recent decades.

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