Now that we have our ActiveX ADO data control up built, we need to connect it to a bound control. Like a standard ADO data control, the only piece missing is the visual representation of the database field values. Let's bind a text box to our new control and test everything out.
1. Click on the text box to provide focus, then bring up the Properties box. Select the
property and voila! Our control is there as a data source for our text box, just like the data control. Now even we VB 6.0 database programmers can create any sort of data bound control we can think of.DataSource
Since the control is data aware, by clicking the
property of the text box, all of the available fields are listed. Our control knows about all of the fields in the DataField
table of the Titles
file:Biblio.mdb
2. Select Title.
When you try to run the program, you must remember this is in a Project Group. Right click on the hostPrj.vbp and click Set as Start Up. Even when you do this, when you run the project you will get this enigmatic error:
Wait! Didn't we just set the project with our form,
as the startup for the project? Yes, but the default startup for our control is frmHost
. Since there is no Sub Main()
, you must select the Startup Object for Sub Main()
and set it to None. This has caused many programmers to pull out whatever hair they have left.dataCtl.vbp