Article ID: 257529 - Last Review: August 7, 2007 - Revision: 2.2

FIX: MonthView's Year is Changed When Setting DayofWeek Property

This article was previously published under Q257529

On This Page

Expand all | Collapse all

SYMPTOMS

When you try to set the DayOfWeek property of the MonthView control to one of the enumerated constants in code, the MonthView's year changes to 1899. This behavior starts occurring after you have changed the date in the MonthView control.

CAUSE

When you try to set the DayOfWeek property to one of the enumerated constants, it is actually setting the value property of the control.

RESOLUTION

Step-by-Step Workaround Procedure

  1. Create a new Standard EXE project. Form1 is created by default.
  2. From the Project menu, select Components, select Microsoft Windows Common Controls-2 6.0, and then click OK.
  3. Add a MonthView control and a CommandButton to Form1.
  4. Add the following code to the General Declarations section of Form1:
    Private Sub Command1_Click()
        MonthView1.Value = MonthView1.Value - MonthView1.DayOfWeek + mvwSunday
    End Sub
    					
  5. Run the Project.
  6. Click on the MonthView control to change the date. Now click the CommandButton. Click the CommandButton again, and note that the year is correct.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022  (http://support.microsoft.com/kb/194022/EN-US/ ) INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295  (http://support.microsoft.com/kb/194295/EN-US/ ) HOWTO: Tell That a Visual Studio Service Pack Is Installed
To download the latest Visual Studio service pack, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx (http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx)

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Standard EXE project. Form1 is created by default.
  2. From the Project menu, select Components, select Microsoft Windows Common Controls-2 6.0, and then click OK.
  3. Add a MonthView control and a CommandButton to Form1.
  4. Add the following code to the General Declarations section of Form1:
    Private Sub Command1_Click()
        MonthView1.DayOfWeek = mvwSunday
    End Sub
    					
  5. Run the project.
  6. Click on the MonthView control to change the date. Now click the CommandButton. Click the CommandButton again, and note that the year is changed to 1899.

APPLIES TO
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbbug kbctrl kbfix kbvs600sp4fix kbvs600sp5fix KB257529
 

Article Translations