Microsoft KB Archive/192090

= BUG: UserControl Property Value Changes Lost When Building EXE =

Article ID: 192090

Article Last Modified on 5/13/2003

-

APPLIES TO


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

-



This article was previously published under Q192090



SYMPTOMS
You have a Standard EXE project that contains a UserControl. You change the property values of the UserControl and build the EXE. The property value changes you made do not take effect in the compiled application, and the property values in the project have reverted back to previous or default values.



RESOLUTION
There are three resolutions to this problem:


 * 1) Run the project before building the EXE. (Make sure the form containing the UserControl is displayed during this process.)
 * 2) Close the form hosting the UserControl before building the EXE.
 * 3) Save the project before building the EXE.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new Standard EXE project in Visual Basic. Form1 is created by default. From the Project menu, add an User Control to the project.  Add the following code to UserControl1: Public Property Get BackColor As OLE_COLOR BackColor = UserControl.BackColor End Property

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR) UserControl.BackColor = New_BackColor PropertyChanged "BackColor" End Property

' Load property values from storage

Private Sub UserControl_ReadProperties(PropBag As PropertyBag) UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F) End Sub

' Write property values to storage Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("BackColor", _           UserControl.BackColor, &H8000000F) End Sub

 Place an instance of UserControl1 on Form1. Click on the UserControl to select it, and change the value of the BackColor property. Build the project (File...Make Project1.exe).</li> Note that the BackColor of the UserControl reverts back to its original color in the IDE.</li> Run the EXE created in step 5. Note that the change to the BackColor property was lost.</li></ol>

Additional query words: kbDSupport kbDSD kbVBp kbCtrl kbVBp600bug kbVBp500bug

Keywords: kbbug KB192090

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.