By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

binding a combobox to dataset

P: n/a
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


Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
-----------------------
"Geraldine Hobley" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.