Data Binding a ComboBox

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

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
 
John said:
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
 
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
 
Back
Top