-
May 16th, 2019, 01:04 PM
#1
Thread Starter
Hyperactive Member
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?
-
May 16th, 2019, 01:21 PM
#2
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?
-
May 16th, 2019, 01:22 PM
#3
Hyperactive Member
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)
-
May 16th, 2019, 02:16 PM
#4
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.
-
May 17th, 2019, 07:55 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|