PC Review


Reply
Thread Tools Rate Thread

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

 
 
Johan Goris
Guest
Posts: n/a
 
      15th Aug 2004
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?




 
Reply With Quote
 
 
 
 
Sijin Joseph
Guest
Posts: n/a
 
      16th Aug 2004
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" <(E-Mail Removed)> wrote in message
news:5o2dnew-(E-Mail Removed)...
> 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?
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's the difference... and DataSet as datasource for Combobox Uli Netzer Microsoft VB .NET 1 17th Sep 2008 11:09 AM
saving Ascii file text as dataset and using it as combobox datasource Nicholas Paldino [.NET/C# MVP] Microsoft C# .NET 3 29th Mar 2004 11:39 PM
HOWTO get info from the other colums of the dataset-table used as datasource for a combobox ? jobi Microsoft VB .NET 2 14th Oct 2003 07:13 AM
ComboBox.DataSource .Net v1.1.4322: Problem to assign new datasource Stephan Microsoft Dot NET Framework 3 10th Oct 2003 08:09 AM
cast datagrid.datasource to dataset (datasource is table) newsgroper@yahoo.com Microsoft Dot NET Framework Forms 1 4th Jul 2003 04:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:39 PM.