Microsoft KB Archive/189924

= BUG: Private Databound UserControl Loses DataBindings in EXE =

Article ID: 189924

Article Last Modified on 3/14/2005

-

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 Q189924



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.



Steps to Reproduce Behavior
 Create a new Standard EXE project. Form1 is created by default. From the Project menu, add a New UserControl (UserControl1) to the project. The Public property of the UserControl is set to False by default. Add a label (Label1) to the UserControl.  Add the following code to the code window of the UserControl: Public Property Get Value As Variant Value = Label1.Caption End Property

Public Property Let Value(ByVal vNewValue As Variant) Label1.Caption = vNewValue End Property  From the Tools Menu, choose Procedure Attributes. Value should be displayed in the Name ComboBox.  Click the Advanced button, and then click the following two CheckBoxes in the Data Binding section: <pre class="fixed_text">     Property is data bound This property binds to DataField </li> Close the UserControl designer and code window.</li> Add a Data control to Form1.</li>  Set the following properties of the Data control: <pre class="fixed_text">DatabaseName = <path to Biblio.mdb> For Visual Basic 5.0, this would be: <pre class="fixed_text">"C:\Program Files\DevStudio\VB\Biblio.mdb" and for Visual Basic 6.0, it would be: <pre class="fixed_text">"C:\Program Files\Microsoft Visual Studio\VB98\Biblio.mdb"

DefaultCursorType = 0 DefaultType = 2 ReadOnly = False RecordsetType = 1 RecordSource = "Authors" </li> Add an instance of UserControl1 to the form.</li>  Change the following properties of UserControl1: DataField = "Author" DataSource = "Data1" </li> Press the F5 key or select Start from the Run menu to run the application.</li> Flip through the authors in Biblio using the Data control to verify that everything works in the IDE.</li> Choose Make Project1.EXE from the File menu.</li> Run the EXE. Note that the UserControl's DataBinding has been lost and the application no longer functions properly.</li> Close the EXE and go back to the Project.</li> Close the form hosting the UserControl and repeat steps 14 - 15. Note that the program functions properly.</li></ol>

Keywords: kbbug kbctrl KB189924

-

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

© Microsoft Corporation. All rights reserved.