473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Data Binding a ComboBox

Hello all:

I am confused on the best method to bind data to a combobox. I have two
tables in my database, one that stores project information, another that
stores contract types. The contract types have an id and a name and are
related to the projects by the id. So I need to populate the box with
the names that are stored in the contract types table but select the
value that has the id stored in the projects table.

John
Nov 17 '05 #1
2 3950
John Smith wrote:
Hello all:

I am confused on the best method to bind data to a combobox. I have two
tables in my database, one that stores project information, another that
stores contract types. The contract types have an id and a name and are
related to the projects by the id. So I need to populate the box with
the names that are stored in the contract types table but select the
value that has the id stored in the projects table.

John

There is a DisplayMember property which corresponds to the
column/property which is displayed.
Im pretty sure there is also a ValueMember (or some such) which
corresponds to a value property.

JB
Nov 17 '05 #2
On Tue, 02 Aug 2005 16:45:20 -0700, John Smith <oh******@hotmail.com>
wrote:
I am confused on the best method to bind data to a combobox. I have two
tables in my database, one that stores project information, another that
stores contract types. The contract types have an id and a name and are
related to the projects by the id. So I need to populate the box with
the names that are stored in the contract types table but select the
value that has the id stored in the projects table.


John:

I wrote up how to do this in an html doc. You can see it at:
http://www.it-resources.com/software/SelectedItems.htm

HTH,

Ken
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bds | last post by:
I'm new to .net 2.0 and I'm trying to figure out the best way to create a form that has a couple of controls and one of the controls is a combo box with a data bound list of items from another...
0
by: Jonathan Lee | last post by:
Hello everybody Why I try to binding data from sqlserver to a comboBox that display System.data.dataRowView in the comboBox? Using following codes string sQueryDetailCatalog = "Select dname...
2
by: Dr. Paul Caesar - CoullByte (UK) Limited | last post by:
Hi everyone, I am writing some C# code using Visual Studio 2003 Enterprise Architech to allow addresses in a database, to be accessesd so that the data can be validated. I have 4 basic tables...
0
by: oracle | last post by:
Greetings, I have a combo box that I binded to a data set using text and tags. I want it to display the DRT.Name property and have a DRT.UnitId as a value. ...
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
1
by: Monty M. | last post by:
Does anyone know how to perform two way data binding between a combo box and a listview. The listview is bound to a dataset table in code: Binding Bind = new Binding(); DataTable dt;...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
9
by: =?Utf-8?B?VGVycnk=?= | last post by:
Think it is great the way that you can set up a datsource, value member, and display member for a combobox, and map a 'code' to a 'description' and back again by binding the combobox to a...
5
by: raajakumars | last post by:
urgent!!!!!!! kindly please anyone help me....... actualy i am newbe to vb.net i need data to be inserted in to my table like this... sitenm cdate wrknm nowrk totwg tamiz palace...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.