BUG: Private Databound UserControl Loses DataBindings in EXE

ID: Q189924


The information in this article applies to:
  • Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0


SYMPTOMS

A private UserControl loses it Data Bindings when compiled to an EXE.


RESOLUTION

Close the form containing the UserControl before making 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. Form1 is created by default.


  2. From the Project menu, add a New UserControl (UserControl1) to the project. The Public property of the UserControl is set to False by default.


  3. Add a label (Label1) to the UserControl.


  4. Add the following code to the code window of the UserControl:


  5. 
    Public Property Get Value() As Variant
              Value = Label1.Caption
          End Property
    
          Public Property Let Value(ByVal vNewValue As Variant)
              Label1.Caption = vNewValue
          End Property 
  6. From the Tools Menu, choose Procedure Attributes. Value should be displayed in the Name ComboBox.


  7. Click the Advanced button, and then click the following two CheckBoxes in the Data Binding section:


  8. 
          Property is data bound
          This property binds to DataField 
  9. Close the UserControl designer and code window.


  10. Add a Data control to Form1.


  11. Set the following properties of the Data control:


  12. 
    DatabaseName = <path to Biblio.mdb> 
    For Visual Basic 5.0, this would be:
    
    "C:\Program Files\DevStudio\VB\Biblio.mdb" 
    and for Visual Basic 6.0, it would be:
    
    "C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb"
    
          DefaultCursorType = 0
          DefaultType = 2
          ReadOnly = False
          RecordsetType = 1
          RecordSource = "Authors" 
  13. Add an instance of UserControl1 to the form.


  14. Change the following properties of UserControl1:


  15. 
          DataField = "Author"
          DataSource = "Data1" 
  16. Press the F5 key or select Start from the Run menu to run the application.


  17. Flip through the authors in Biblio using the Data control to verify that everything works in the IDE.


  18. Choose Make Project1.EXE from the File menu.


  19. Run the EXE. Note that the UserControl's DataBinding has been lost and the application no longer functions properly.


  20. Close the EXE and go back to the Project.


  21. Close the form hosting the UserControl and repeat steps 14 - 15. Note that the program functions properly.


Additional query words:

Keywords : kbCtrl kbVBp kbVBp500bug kbVBp600bug kbGrpVB
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: April 27, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.