binding a combobox to dataset

  • Thread starter Thread starter Geraldine Hobley
  • Start date Start date
G

Geraldine Hobley

Hello,
I have a combobox on my form called "cmbstatus". I
wish the display values to be taken from a look up table
in a dataset "dsstatus" called Projectstatus with the
description field Projectstatus containing the values to
be displayed.

MyProjectInfo.cmbStatus.DataSource = dsStatus.Tables!
Projectstatus.DefaultView
MyProjectInfo.cmbStatus.DisplayMember = "ProjectStatus"

However I wish to bind the combobox to a collection
called Projlist and inparticular a property
called "status" which contains the Projectstatuskey from
the main database table (as supposed to the lookup dbtable)

What do I set the cmbstatus ValueMember to.

I've tried
MyProjectInfo.cmbstatus.databindgings.add
("valuemember",Projlist,"status") which is how I bind my
text boxes successfully, but it won't let me do this.

also what do bind the selectedvalue to.

Any help would be greatly appreciated.

Regards
Geraldine
 
Hi,

The combobox displaymember and valuemember must be from the
datasource. Dont forget to add a displaymember. To bind to a collection
this will work.

MyProjectInfo.cmbStatus.DataSource = projlist
MyProjectInfo.cmbStatus.DisplayMember = "Status"
MyProjectInfo.cmbStatus.ValueMember = "Status"

Ken
 
Back
Top