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
- 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:
Property is data bound
This property binds to DataField
- Close the UserControl designer and code window.
- Add a Data control to Form1.
- Set the following properties of the Data control:
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"
- Add an instance of UserControl1 to the form.
- Change the following properties of UserControl1:
DataField = "Author"
DataSource = "Data1"
- Press the F5 key or select Start from the Run menu to run the
application.
- Flip through the authors in Biblio using the Data control to verify
that everything works in the IDE.
- Choose Make Project1.EXE from the File menu.
- Run the EXE. Note that the UserControl's DataBinding has been lost and
the application no longer functions properly.
- Close the EXE and go back to the Project.
- 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