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

weird but heavy problem with ComboBoxes and DataSource

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:

this.cmbBx_SelectProjekte.DataSource =
ergoDB._ProjectsDS.Tables["Projekte"];
this.cmbBx_SelectProjekte.DisplayMember = "BV_Name";

and the "Sorted" Property set to true, the comboBox remains empty !?!?
If I change the "Sorted" property to false, it works, I get the content from
the DataSet.

But with three big problems:
First of all, in that instance that I open the dropdown section of the
comboBox, the first Item is selected. This must not happen, since a lot of
code gets executed in the "SelectedItemChanged" Event, which should only be
executed if the USER selected an item.
The second problem is, that the SelectedItems are typeof
System.Data.DataRowView.
Why? The content of my DataSet consists of strings, which I do get if I use
a for-loop to fill the ComboBox.
Even worse, before the first string from the dataset finally arrives in the
box, there are two System.Data.DataRow Strings(!!) getting written into the
ComboBox that I need to filter?!?!?

But the worst problem of all is, that I do need the content SORTED.

Now, one other solutions erases some of my problems, but creates weird new
ones:

If I fill my comboBox with this:

for(int i=0; i<ergoDB._ProjectsDS.Tables["Projekte"].Rows.Count; i++)
{
this.cmbBx_SelectProjekte.Items.Add(ergoDB._Projec tsDS.Tables["Projekte"].Rows[i].ItemArray[1]);
}

and "Sorted" = true, its all fine. I got the drowDown Section filled, no
item is selected until I do so explicitly and the items in the array are
typeof string.
So far so good, I should be happy here. Should I?

If I set Sorted to false, the comboBox gets filled with the following string:
System.Data.DataViewManagerListItemTypeDescriptor
?!?!?!?!?!?

Now here's why I can't go for the loop and Sorted = true:
In the end, the strings that fill the combobox need to consists of two
columns of my dataset (projectnumber and projectname appended).
Heres the catch: If an item is selected, I do need the ValueMember property,
since I must process the projectnumber differently from the rest.
So I can't go with the loop, which is the only one that so far fully works.

What the hell is going on here?
This is driving me crazy, I have so much other stuff to take care off...
Please, I need help quite desperatly...

Jul 21 '05 #1
0 1131

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...
0
by: Timothy White | last post by:
I have a Windows Form Which Displays one record at a time. The DataTable object which is bound to the Form Controls only contains the record that is being displayed. When I need to display a...
1
by: Stijn Goris | last post by:
Hi all, I have 3 Comboboxes i want to bind with 3 different DatTables. I use this.cbxProductCategory.DataSource = myDataTable; this.cbxProductCategory.DisplayMember = "PTCA_DESCR";...
1
by: Keith Henderson | last post by:
I have a datatable that needs to be the datasource for 10 comboboxes. how do I do a for each for page_load to do this?
0
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...
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
4
by: ECathell | last post by:
I am trying to databind 2 combo boxes to the same datasource but different fields using the same lookup table. The information in combobox2 is duplicating combobox 1(ie it appears to be gathering the...
2
by: Wingot | last post by:
Hey, I have a view to a database that I have created for Client Maintenance. It has a number of fields, but the important ones are Medical Condition, Bill To, and Country. I have a couple of...
1
by: Alex | last post by:
Hi, I have a strange question... I have a series of combo boxes being populated by the same dataset, and I've noticed if one is changed then all change as well. I'm using Visual Basic 2005 and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.