|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
>From: Laura Wicklund <LW000005728@ltu.edu>
>To: binoy_rb@hotmail.com >CC: littleloukal@aol.com >Subject: VB combo box >Date: Wed, 14 Apr 2004 12:13:58 -0400 > >I am trying to use an ADO control within VB to bind to an Access database. The connection is successful, but when I run the program, I get an error message that says I can not bind to the field which I specified in the DataField property window of my combo box in VB. Do you have any suggestions or comments? > >Your response is appreciated, > >Laura Wicklund >littleloukal@aol.com ~~~~~~~~~~~~ Suggested answer =============== Once you successfully able to open the access connection to combo box, next you will be able to see all the associated database table listed in the datalist property. Binding a datasource to a combo box isn't difficult. Make sure that you selected the table first, before binding field name to listField and BoundColumn properties. Once you set a successful connection, next you need to do the following things: ListField: Click on the pulldown button of the listfield and you will see all fields that are from the table which you want to select from your database, and choose the field name you want to display. BoundColumn: Same as Listfield but this time choose field name This is all that is required to load a DataComboBox. The BoundColumn is where you usually want to put an Indentity type of field so you know exactly what row it is referenced too. What this means is that the ID of the Publisher table is PubID, having the value will make it so you can access all the info you want on that particular publisher. Now when you select an item from a DataComboBox you can use the Change event to see what item was selected; 'Set fields in recordset to datacombobox dbcName.BoundColumn = Bound Field Name dbcName.ListField = List Field Name 'Bind recordset to datacombobox Set dbcName.RowSource = Data Source name In VB 7.0 or .NET, ================= The following code has to do: MyComboBox.DataSource = MyDataSource.Tables("Employees") or MyComboBox.DataSource = MyDataSource MyComboBox.DataMember = "Employees" ~~~~~~~~ If any suggestions, let me know. (binoy_rb@hotmail.com thanks Benoy |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Can not bind to the field in the DataField property window of combo box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|