473,407 Members | 2,326 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,407 software developers and data experts.

Could not bind to the new display member error

i've got a table in my dataSet that looks like this:

<tblTasks>

<taskID>0</taskID>

<projectID>0</projectID>

<summary>-- Select A Task --</summary>

</tblTasks>

<tblTasks>

<taskID>662</taskID>

<projectID>19</projectID>

<summary>Addition - Add Update to MeetComp</summary>

</tblTasks>

when trying to bind to my comboBox as follows:

cboTasks.DataSource = oDataSet.Tables["tblTasks"].Select(null, "taskID",
DataViewRowState.CurrentRows);

cboTasks.DisplayMember = "summary";

cboTasks.ValueMember = "taskID";

i get the "Could not bind ot the new display member" error. any ideas why?

tks

Nov 17 '05 #1
2 4680
Dica,

In this, you are binding to an array of data rows. I don't think that
this is a good idea.

Try creating a new DataView and binding to it, like this:

// The data view.
DataView view = new DataView(oDataSet.Tables["tblTasks"], null, "taskID",
DataViewRowState.CurrentRows);

// Set the display member before setting the data source.
cboTasks.DisplayMember = "summary";

// Set the data source to the data view.
cboTasks.DataSource = view;

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dica" <ge*****@hotmail.com> wrote in message
news:IY******************************@rogers.com.. .
i've got a table in my dataSet that looks like this:

<tblTasks>

<taskID>0</taskID>

<projectID>0</projectID>

<summary>-- Select A Task --</summary>

</tblTasks>

<tblTasks>

<taskID>662</taskID>

<projectID>19</projectID>

<summary>Addition - Add Update to MeetComp</summary>

</tblTasks>

when trying to bind to my comboBox as follows:

cboTasks.DataSource = oDataSet.Tables["tblTasks"].Select(null, "taskID",
DataViewRowState.CurrentRows);

cboTasks.DisplayMember = "summary";

cboTasks.ValueMember = "taskID";

i get the "Could not bind ot the new display member" error. any ideas why?

tks

Nov 17 '05 #2

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:u1**************@TK2MSFTNGP12.phx.gbl...
Dica,

In this, you are binding to an array of data rows. I don't think that
this is a good idea.

Try creating a new DataView and binding to it, like this:

// The data view.
DataView view = new DataView(oDataSet.Tables["tblTasks"], null, "taskID",
DataViewRowState.CurrentRows);

// Set the display member before setting the data source.
cboTasks.DisplayMember = "summary";

// Set the data source to the data view.
cboTasks.DataSource = view;
works perfect. tks.

however, i'm curious, why set the display member prior to setting the
dataSource?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dica" <ge*****@hotmail.com> wrote in message
news:IY******************************@rogers.com.. .
i've got a table in my dataSet that looks like this:

<tblTasks>

<taskID>0</taskID>

<projectID>0</projectID>

<summary>-- Select A Task --</summary>

</tblTasks>

<tblTasks>

<taskID>662</taskID>

<projectID>19</projectID>

<summary>Addition - Add Update to MeetComp</summary>

</tblTasks>

when trying to bind to my comboBox as follows:

cboTasks.DataSource = oDataSet.Tables["tblTasks"].Select(null, "taskID",
DataViewRowState.CurrentRows);

cboTasks.DisplayMember = "summary";

cboTasks.ValueMember = "taskID";

i get the "Could not bind ot the new display member" error. any ideas why?
tks


Nov 17 '05 #3

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

Similar topics

2
by: P G | last post by:
I hope this is on topic here. I have a problem compiling a simple example of the use of boost::bind. Please take a look at the program below. ...
4
by: Arturo Cuebas | last post by:
The program below contains a compile error. Following the program you will find the typical fix then my idea for a library that facilitates a more elegant fix. #include <boost\bind.hpp> using...
7
by: USUN_TO | last post by:
Hi, i got problem when i bind in this way: local_addr.sin_family = AF_INET; local_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); local_addr.sin_port = htons(CLIENT_PORT); i can easly bind...
6
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
11
by: Michael Kellogg | last post by:
I have a collection of custom objects that I am displaying in a Windows Forms Datagrid. To display it, I take the collection and build a DataTable object on the fly, then set the grid's DataSource...
6
by: Toby Bradshaw | last post by:
Hi, Consider the following: class A { public: virtual bool foo() = 0; };
1
by: Olaf Petzold | last post by:
Hi, at this time I try to combine Qt and boost. Unfortunately I've run into trouble: void QWidget::insertAction ( QAction * before, QAction * action ); class QAction : public QWidget { ... };...
2
by: =?Utf-8?B?SmFtZXMgTWFydGlu?= | last post by:
I have a table that I dragged onto a form from a dataset. I changed some of the fields to comboboxes and set the data source, display member (text), and value member (int) to another table within...
3
by: Giovanni Gherdovich | last post by:
Hello, in the following code I have a pointer (to function), say p, of type double (*)(double, double, void*) and I try to fix the second argument of the function *p to a given value (using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.