Microsoft KB Archive/223101

= FIX: WriteProperties Event Fires Incorrectly =

Article ID: 223101

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q223101



SYMPTOMS
A UserControl in a project always executes the WriteProperties event prior to the Resize event. According to Key UserControl Events in the product documentation at the URL below, the WriteProperties event only executes when the design-time instance of the control is destroyed or when a property value for the control is changed:

http://msdn.microsoft.com/library/devprods/vs6/vb/html/vbconwerenotinkansasanymore.htm



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 Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



MORE INFORMATION
This section shows you how to create a sample project that demonstrates the bug behavior. The section assumes you are familiar with creating ActiveX controls and adding ActiveX controls to standard projects. If you are not familiar with these tasks, see the REFERENCES section below for more information.

Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. From the File menu, add an ActiveX Control project to your Standard EXE project. UserControl1 is created by default.  Copy the following code to the Code Window of the UserControl: Option Explicit

Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Debug.Print "read Properties" End Sub

Private Sub UserControl_Resize Debug.Print "resize" End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Debug.Print "write Properties" End Sub  Close all the windows associated with ActiveX Control project. The ActiveX Control appears on the Toolbox. From the View menu, select Immediate Window. Add the ActiveX Control to Form1 of the Standard EXE project (this causes the first resize event to fire.)</li>  From the Run menu, select Start, or press the F5 key to run the program.

The following appears in the Intermediate Window: resize write Properties resize read Properties The expected behavior is for the Resize Event to fire first, followed by the ReadProperties Event. The WriteProperties Event should not fire. </li></ol>

<div class="references_section">