473,387 Members | 1,486 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.

Filling DataRow[] into combobox

Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim

Dec 18 '06 #1
8 11906
Hi Kim,

Try loading the data into a new DataView class and use the RowFilter
property instead. You can bind to the DataView directly.

--
Dave Sexton

<ki***********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim

Dec 18 '06 #2
Hi,

What is wrong with your debugger?
the code seems to be ok but if you do not know what is going on is a little
difficult to know the reason.

Also a little more detail could help, what exception u r getting and where?
--
Ignacio Machin
machin AT laceupsolutions com

<ki***********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim

Dec 18 '06 #3
Hi Kim,

I shouldn't have wrote "loading the data" since the DataView doesn't contain
any data at all, it just wraps the specified DataTable. In other words, you
should just create a "view" of the data that you want - using a DataView
won't actually copy the data into a new object.

DataView view = myDataSet.Tables["receivers"].DefaultView;
or
DataView view = new DataView(myDataSet.Tables["receivers"]);

view.RowFilter = "location_key=" + selectedLocationKey;

comboBox.DataSource = view;
comboBox.DisplayMember = "text";
comboBox.ValueMember = "subcustomer_location_key";

Also, you should think about strong-typing your DataSet.

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:u1**************@TK2MSFTNGP03.phx.gbl...
Hi Kim,

Try loading the data into a new DataView class and use the RowFilter
property instead. You can bind to the DataView directly.

--
Dave Sexton

<ki***********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
>Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim


Dec 18 '06 #4
Hi Dave!

Thank you for your help - it works. I had forgotten that the DataView
existed :-)

Best regards,
Kim Therkelsen

Hi Kim,

I shouldn't have wrote "loading the data" since the DataView doesn't contain
any data at all, it just wraps the specified DataTable. In other words, you
should just create a "view" of the data that you want - using a DataView
won't actually copy the data into a new object.

DataView view = myDataSet.Tables["receivers"].DefaultView;
or
DataView view = new DataView(myDataSet.Tables["receivers"]);

view.RowFilter = "location_key=" + selectedLocationKey;

comboBox.DataSource = view;
comboBox.DisplayMember = "text";
comboBox.ValueMember = "subcustomer_location_key";

Also, you should think about strong-typing your DataSet.

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:u1**************@TK2MSFTNGP03.phx.gbl...
Hi Kim,

Try loading the data into a new DataView class and use the RowFilter
property instead. You can bind to the DataView directly.

--
Dave Sexton

<ki***********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim
Dec 19 '06 #5
Hi Ignacio,
I think I have to rephrase the problem with the debugger.

I am developing software for a Windows CE 4.2 PDA. When I run the
software on the PDA from Visual Studio 2005 in debug mode and get an
exception, the contents of the exception can not be shown because some
sort of debugging information is missing.

To make the software made in VS2005 run on the PDA I had to install the
..Net compact framework 2.0 manually. I think somehow the missing debug
information is related to the installation of the .Net framework.

Best regards,
Kim

Hi,

What is wrong with your debugger?
the code seems to be ok but if you do not know what is going on is a little
difficult to know the reason.

Also a little more detail could help, what exception u r getting and where?
--
Ignacio Machin
machin AT laceupsolutions com

<ki***********@gmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
Hi,
I do this:

this.comboBox.DataSource =
myDataSet.Tables["receivers"].Select("location_key = " +
selectedLocationKey);
this.comboBox.DisplayMember = "text";
this.comboBox.ValueMember = "subcustomer_location_key";

but get an exception when setting the value member. Unfortunately there
is something wrong with my debugger so I can't see what is in the
exception. I am sure that the columns are named "text" and
"subcustomer_location_key".
I have also tried with the table name: "subreceivers.text" and
"subreceivers.subcustomer_location_key". The same thing happens.

How do I refer to the columns of the data rows in the DataRow array so
that the combobox understands it?

Best regards,
Kim
Dec 19 '06 #6
Hi,
<ki***********@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi Ignacio,
I think I have to rephrase the problem with the debugger.

I am developing software for a Windows CE 4.2 PDA. When I run the
software on the PDA from Visual Studio 2005 in debug mode and get an
exception, the contents of the exception can not be shown because some
sort of debugging information is missing.
Weird, are you getting something about "resource assembly" ?
To make the software made in VS2005 run on the PDA I had to install the
.Net compact framework 2.0 manually. I think somehow the missing debug
information is related to the installation of the .Net framework.
I had never need to install the framework manually, it's always installed
from the IDE when you run the app.

I think you have something wrong with your dev. environment.

--
Ignacio Machin
machin AT laceupsolutions com
Dec 19 '06 #7
Hi again,

I get the message:
"An error message cannot be displayed because an optional resource
assembly containing it cannot be found"
whenever I get an exception.

It IS necessary to install the .Net framework 2.0 manually:
http://blogs.msdn.com/markprenticems...08/692624.aspx

Best regards,
Kim

Ignacio Machin ( .NET/ C# MVP ) skrev:
Hi,
<ki***********@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi Ignacio,
I think I have to rephrase the problem with the debugger.

I am developing software for a Windows CE 4.2 PDA. When I run the
software on the PDA from Visual Studio 2005 in debug mode and get an
exception, the contents of the exception can not be shown because some
sort of debugging information is missing.

Weird, are you getting something about "resource assembly" ?
To make the software made in VS2005 run on the PDA I had to install the
.Net compact framework 2.0 manually. I think somehow the missing debug
information is related to the installation of the .Net framework.

I had never need to install the framework manually, it's always installed
from the IDE when you run the app.

I think you have something wrong with your dev. environment.

--
Ignacio Machin
machin AT laceupsolutions com
Dec 20 '06 #8
Hi,

This seems like the old "resource assembly" error in 1.1, maybe is the same
one.

Check the blog of the CF to see if there are answers there.
--
Ignacio Machin
machin AT laceupsolutions com

<ki***********@gmail.comwrote in message
news:11**********************@48g2000cwx.googlegro ups.com...
Hi again,

I get the message:
"An error message cannot be displayed because an optional resource
assembly containing it cannot be found"
whenever I get an exception.

It IS necessary to install the .Net framework 2.0 manually:
http://blogs.msdn.com/markprenticems...08/692624.aspx

Best regards,
Kim

Ignacio Machin ( .NET/ C# MVP ) skrev:
>Hi,
<ki***********@gmail.comwrote in message
news:11**********************@n67g2000cwd.googleg roups.com...
Hi Ignacio,
I think I have to rephrase the problem with the debugger.

I am developing software for a Windows CE 4.2 PDA. When I run the
software on the PDA from Visual Studio 2005 in debug mode and get an
exception, the contents of the exception can not be shown because some
sort of debugging information is missing.

Weird, are you getting something about "resource assembly" ?
To make the software made in VS2005 run on the PDA I had to install the
.Net compact framework 2.0 manually. I think somehow the missing debug
information is related to the installation of the .Net framework.

I had never need to install the framework manually, it's always installed
from the IDE when you run the app.

I think you have something wrong with your dev. environment.

--
Ignacio Machin
machin AT laceupsolutions com

Dec 21 '06 #9

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

Similar topics

1
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
3
by: Shravan | last post by:
Hi, How can I bind DataRow array to ComboBox. I tried setting DataSource -> DataRow Array DisplayMember -> ColumnName But it was showing "System.Data.DataRow" for every item in the...
2
by: Hugo Lefevre | last post by:
dear, I have a form (frmlogonaccounts.cs) with a combobox, which I want to fill up with the first column of a dataset. The dataset is created in the class Login. My problem is the next : I make...
1
by: MrNobody | last post by:
I seem to be having trouble trying to select the right value in a ComboBox DataSourced by a DataTable with a value for a DataRow... For example... In a Windows Form, I have a ComboBox: ...
1
by: reidarT | last post by:
I am filling a combobox with data from a table. This is done with the code below. After update of the combobox I want to fill txtField2 with data from Field2 in the select-statement. How can I do...
0
by: reidarT | last post by:
I have found a good combobox with multiple fields The example shows filling the combobox from a listview, but I want to fill it with zip-code and cities from a database. The example is as follows:...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
0
by: sixths3ns3 | last post by:
My DataGridView has two columns. Combobox Column 2 displays list based on Combobox Column 1 selected value. The code below works fine when I select a value on Column 1, and select a value on Column...
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: 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
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: 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:
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...

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.