473,382 Members | 1,204 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,382 software developers and data experts.

binding a combobox to dataset

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
1 1468
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
5
by: Greg Dunn | last post by:
I have two tables in a parent-child relationship. Details on the tables are as shown below: Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2) Table2 -------
13
by: Paul Slavin | last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this?? any answers appreciated, as to due to the underlying...
1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
10
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
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. ...
3
by: Peter | last post by:
OK, so in addition to the problem I mentioned before (c.f. "Data Binding to Textbox"), I realized that my comboboxes are not really bound to the internal data set. They are just set to manually...
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;...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.