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

How can I use a dataset as datasource for a combobox?

I've tried to use a dataset as datasource for a combobox in the following
manner:

private void button1_Click(object sender, System.EventArgs e)

{

Classes.ProdOrders pr = new Classes.ProdOrders();

comboBox1.DataSource = pr.GiveList(1).Tables[0]; // a datasource is made,
sql is excecuted with a table with id and prodorder.

comboBox1.ValueMember = "id";

comboBox1.DisplayMember = "prodorder"; // can not bind!

}

But it cannot bind. What is wrong?


Nov 16 '05 #1
1 1259
Do you get an exception? What does the combo display? Check field names and
that data is actually present in the table.

--
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
"Johan Goris" <jo*********@pi.be> wrote in message
news:5o********************@scarlet.biz...
I've tried to use a dataset as datasource for a combobox in the following
manner:

private void button1_Click(object sender, System.EventArgs e)

{

Classes.ProdOrders pr = new Classes.ProdOrders();

comboBox1.DataSource = pr.GiveList(1).Tables[0]; // a datasource is made,
sql is excecuted with a table with id and prodorder.

comboBox1.ValueMember = "id";

comboBox1.DisplayMember = "prodorder"; // can not bind!

}

But it cannot bind. What is wrong?

Nov 16 '05 #2

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

Similar topics

7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
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...
2
by: jobi | last post by:
Hi, I have this combobox which has a table from a dataset as datasource. When I click an item on the combobox-list , I would like to display (in textfield) the value from an other column that...
7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
7
by: Marty | last post by:
Hi, Ok I use the OLEDBConnector and dataset to retrieve data from my Access DB. I have a problem to read/parse the dataset and I would like to know if I am using the right object to reach my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.