Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
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  
Old April 15th, 2004, 10:01 AM
benoyraj benoyraj is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: US
Posts: 15 benoyraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Can not bind to the field in the DataField property window of combo box

>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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Can not bind to the field in the DataField property window of combo box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway