DOCUMENT:Q192090 02-SEP-1998 [vbwin] TITLE :BUG: UserControl Property Value Changes Lost When Building EXE PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,6.0 OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 --------------------------------------------------------------------- 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. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Create a new Standard EXE project in Visual Basic. Form1 is created by default. 2. From the Project menu, add an User Control to the project. 3. 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 3. Place an instance of UserControl1 on Form1. 4. Click on the UserControl to select it, and change the value of the BackColor property. 5. Build the project (File...Make Project1.exe). 6. Note that the BackColor of the UserControl reverts back to its original color in the IDE. 7. Run the EXE created in step 5. Note that the change to the BackColor property was lost. Additional query words: kbDSupport kbDSD kbVBp kbCtrl kbVBp600bug kbVBp500bug ====================================================================== Version : WINDOWS:5.0,6.0 Platform : WINDOWS Issue type : kbbug ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.