473,804 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

listbox.addrang e winforms

Hi,

A colleague of mine has added a 60,000 array of strings to a listbox using
the addrange method.
He did this because it seemed the quickest method of getting 60,000 items
into the listbox.

He would now like different "text" and "value" properties for each item in
the listbox. Given the number of items, what would be the most efficient way
of doing this?

regards,

Richard
Nov 21 '05 #1
1 1991
Richard,
First a question: how do you expect your users to navigate 60,000 items in a
list box. I would think most users would complain about navigating 60 items
in a list box, much less 1000, but 60,000??

Second I would still seriously question any design that required 60,000
items in a listbox.

You can either use a DataTable or a custom class to define text & value
pairs that the ListBox could then display.

You could possibly even use an owner draw listbox, that you bind to the
array of strings, then the DrawItem event looks up the value from the
Text...

Hope this helps
Jay

"Richard Bond" <Ri**********@t nsofres.com> wrote in message
news:eS******** *****@TK2MSFTNG P12.phx.gbl...
Hi,

A colleague of mine has added a 60,000 array of strings to a listbox using
the addrange method.
He did this because it seemed the quickest method of getting 60,000 items
into the listbox.

He would now like different "text" and "value" properties for each item in
the listbox. Given the number of items, what would be the most efficient
way
of doing this?

regards,

Richard

Nov 21 '05 #2

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

Similar topics

5
16472
by: GG | last post by:
I know I can scroll to the last item in the listbox by calling SetSelected all the time What I need is when I add items through the Items.Add or Items.AddRange to be called automatically and go the the bottom. Anybody knows how to be implemented? Thanks
3
8903
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C Me.ListBoxPerson.Items.AddRange(ary)
2
15628
by: andrewcw | last post by:
This is wrong but it seems I might be on track somewhat close: I want to display my ArrayList of Random numbers in the list box. Below you see this as aLRandoms. There seems to be a provision to load a range : listBox1.Items.AddRange(lboxObjCol); so I try to load the lboxObjCol as shown: System.Windows.Forms.ListBox.ObjectCollection lboxObjCol = new ListBox.ObjectCollection(listBox1, (object)aLRandoms);
3
3533
by: andrewcw | last post by:
Who can explain this ?? : I expect 2 but I get 4 items ! private void button1_Click(object sender, EventArgs e) { object bunchOfStuff = { "foo", "fee" }; listBox1.Items.Clear(); System.Windows.Forms.ListBox.ObjectCollection lboxObjCol = new ListBox.ObjectCollection(listBox1, bunchOfStuff); listBox1.Items.AddRange(lboxObjCol);
0
1055
by: GentOfTheLake | last post by:
Why won't the webcontrols version of the listbox work with this: DirectoryInfo di = new DirectoryInfo(); FileInfo fi = di.GetFiles(); ListBox lb = new ListBox(); lb.AddRange(fi); The forms version of the listbox handles this just fine. Does anyone know how to convert the FileInfo to ListItem for the
5
7436
by: markr1000 | last post by:
I must have looked searched in 500+ places that showed up in Google searchs, but not one has an example of what I want to do. I have a Listbox on a User Control because I want to control the visibility and/or presence of the Listbox and associated label, and I want to encapsulate some of associated code. I want to be able to pass the collection of strings that will fill the Listbox to the User Control and have it pass on the collection...
4
2824
by: Rotsey | last post by:
Hi, I have a listbox and I am adding objects to it with AddRange. The problem is the listbox just shows the name of object class in every row and not the DisplayMember see below. Any ideas?? void mWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
5
2857
by: Academia | last post by:
(If you've seen this in the drawing NG, sorry. I inadvertently sent it there.) I have a listbox populated with Objects. The Class has a String field that ToString returns. I assume that is what the ListBox uses for its display. Correct?
3
1580
by: itisthiyagu | last post by:
Hi, Im looking for ListBox which works like Windows-XP's Add/Remove programs listbox. where can i get this kind of listbox ? I want to show a text in ListItem & it should expand with its description when user selects a particular item. Also i want to add a button into to ListItem. it is same like Add/Remove programs ListBox. anybody help me. -Thiyagu
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
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...
1
10361
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9179
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
6874
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
5536
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
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
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
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.