473,488 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hastable/SortedList->Combobox

Hello all,

I've looked on the net and can't seem to find what I need so I must be
searching badly or have (another) 'non-problem'.
I am simply trying to move the values of a hastable or sorted list into a
combobox control. I'm willing to lose the key item of the collection I just
need the values.
Surely i don't need to enumerate the entire collection adn add the values
one by one into the combobox?

Thanks
Nev
Nov 16 '05 #1
3 3693
"nevin" <nevin@[diespam]myself.com> wrote in message
news:40***********************@mercury.nildram.net ...
Hello all,

I've looked on the net and can't seem to find what I need so I must be
searching badly or have (another) 'non-problem'.
I am simply trying to move the values of a hastable or sorted list into a
combobox control. I'm willing to lose the key item of the collection I just need the values.
Surely i don't need to enumerate the entire collection adn add the values
one by one into the combobox?

Thanks
Nev


http://samples.gotdotnet.com/quickst...ding.cs&font=3

(URL will be word-wrapped)

Erik
Nov 16 '05 #2
Since ComboBox.Items is of the class ComboBox.ObjectCollection you can
use its AddRange(object[]) method to quickly add all the items. You
might have to use ICollection.CopyTo() to get them from the hashtable in
to an Object[], although I seem to remember an easier way, I just can't
find it at the moment.

I hope that helps!
DC
Nov 16 '05 #3
The way I ended up doing it was:

combo.DataSource=sortedlist.GetValueList();

Thanks to Eric and DC for the pointers.

"nevin" <nevin@[diespam]myself.com> wrote in message
news:40***********************@mercury.nildram.net ...
Hello all,

I've looked on the net and can't seem to find what I need so I must be
searching badly or have (another) 'non-problem'.
I am simply trying to move the values of a hastable or sorted list into a
combobox control. I'm willing to lose the key item of the collection I just need the values.
Surely i don't need to enumerate the entire collection adn add the values
one by one into the combobox?

Thanks
Nev

Nov 16 '05 #4

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

Similar topics

2
253
by: Brett Hewitson | last post by:
I am new to C# and I am trying to implement a class that implements the System.Collections.IDictionary class. So far this is what I have. using System; namespace Test1 { public class...
2
6922
by: Jim Heavey | last post by:
I thought I could create a "ListViewItem" and then bind that item to a combox box, but perhaps that is was with an ASP.Net control. When I create a listViewItem and bind it to a combo box, it does...
18
1741
by: Doug Bell | last post by:
Hi, I have a function that loads Rows from a field in a DataTable into an ArrayList. See below: It also adds a Row (eg "All Areas"). I wanted this new row to be the first record so I added a...
7
1469
by: Brett Romero | last post by:
I'd like to copy a object1 into object2 so object2 can be manipulated. Object1 is coming form the middle layer into the UI layer. I'd like to rename a field in Object2 from "somethingID" to just...
4
10104
by: SHEBERT | last post by:
Here is an example of a SortedList that works as a datasource to the ComboBox and a generic SortedList<that does not works as a datasource to the ComboBox. Why? If I use List and generic List<>,...
2
1686
by: Chicken15 | last post by:
Hi Group. First of all I'm sorry for asking (maybe) such easy questions. But I'm quite stuck now and couldn't come up with a solution by using my C# book or googling. So it would be nice if...
19
2183
by: active | last post by:
I'm using a ComboBox to display objects of a class I've defined, say CQQ. Works great except somehow I occasionally set an Item to a String object instead of an object of type CQQ. It looks...
9
1984
by: active | last post by:
Can you see why this does not sort the list? It displays OK but is not sorted Thanks for any help
0
7108
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
7142
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
7181
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...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4565
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...
0
3078
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...
0
1383
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 ...
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.