473,588 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filling DataRow[] into combobox

Hi,
I do this:

this.comboBox.D ataSource =
myDataSet.Table s["receivers"].Select("locati on_key = " +
selectedLocatio nKey);
this.comboBox.D isplayMember = "text";
this.comboBox.V alueMember = "subcustomer_lo cation_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_lo cation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers.s ubcustomer_loca tion_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 11919
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.goog legroups.com...
Hi,
I do this:

this.comboBox.D ataSource =
myDataSet.Table s["receivers"].Select("locati on_key = " +
selectedLocatio nKey);
this.comboBox.D isplayMember = "text";
this.comboBox.V alueMember = "subcustomer_lo cation_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_lo cation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers.s ubcustomer_loca tion_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.goog legroups.com...
Hi,
I do this:

this.comboBox.D ataSource =
myDataSet.Table s["receivers"].Select("locati on_key = " +
selectedLocatio nKey);
this.comboBox.D isplayMember = "text";
this.comboBox.V alueMember = "subcustomer_lo cation_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_lo cation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers.s ubcustomer_loca tion_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.Table s["receivers"].DefaultView;
or
DataView view = new DataView(myData Set.Tables["receivers"]);

view.RowFilter = "location_k ey=" + selectedLocatio nKey;

comboBox.DataSo urce = view;
comboBox.Displa yMember = "text";
comboBox.ValueM ember = "subcustomer_lo cation_key";

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

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:u1******** ******@TK2MSFTN GP03.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.goog legroups.com...
>Hi,
I do this:

this.comboBox. DataSource =
myDataSet.Tabl es["receivers"].Select("locati on_key = " +
selectedLocati onKey);
this.comboBox. DisplayMember = "text";
this.comboBox. ValueMember = "subcustomer_lo cation_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_l ocation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers. subcustomer_loc ation_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.Table s["receivers"].DefaultView;
or
DataView view = new DataView(myData Set.Tables["receivers"]);

view.RowFilter = "location_k ey=" + selectedLocatio nKey;

comboBox.DataSo urce = view;
comboBox.Displa yMember = "text";
comboBox.ValueM ember = "subcustomer_lo cation_key";

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

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:u1******** ******@TK2MSFTN GP03.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.goog legroups.com...
Hi,
I do this:

this.comboBox.D ataSource =
myDataSet.Table s["receivers"].Select("locati on_key = " +
selectedLocatio nKey);
this.comboBox.D isplayMember = "text";
this.comboBox.V alueMember = "subcustomer_lo cation_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_lo cation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers.s ubcustomer_loca tion_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.goog legroups.com...
Hi,
I do this:

this.comboBox.D ataSource =
myDataSet.Table s["receivers"].Select("locati on_key = " +
selectedLocatio nKey);
this.comboBox.D isplayMember = "text";
this.comboBox.V alueMember = "subcustomer_lo cation_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_lo cation_key".
I have also tried with the table name: "subreceivers.t ext" and
"subreceivers.s ubcustomer_loca tion_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.goo glegroups.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.goo glegroups.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.goog legroups.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.go oglegroups.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
2092
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 content of an untyped DataSet. This is to be done in the "DropDown" Event (since the dataset is empty at program start). If I go with this:
3
14678
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 combobox instead of fetching the
2
3460
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 a new login in the form loginaccount which create a new login and give me a dataset (created by class login), which I can see in my datagrid. But I want to fill up my combobox with only the name of the logon and I do this with an foreach. But when...
1
1981
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: ComboBox box = new ComboBox(whatever); box.DataSource = myDataTable; box.DataMember = "the_column"; // now select value already in a passed DataRow
1
1573
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 that? private void Page_Load(object sender, System.EventArgs e) { if (! Page.IsPostBack) {
0
1237
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: Dim dtLoading As New DataTable("UsStates") dtLoading.Columns.Add("Name", System.Type.GetType("System.String")) dtLoading.Columns.Add("Abbreviation", System.Type.GetType("System.String"))
2
946
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 making this work...
0
2238
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 2. But on the next row, when I leave Column 1 blank and click on Column 2, it generates error DataGridViewComboBoxCell value is invalid. And the code below works fine the first time I click Column 2, leaving Column 1 blank. I just want to...
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8354
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8223
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3883
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2371
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.