473,545 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List box, quickly removing many items

We are trying to implement a dual list box selection where you have two list
boxes, You highlight items in the right side list box, click a button and
this moves those items over to the left hand list box. The problem is that
if there are many items selected (thousands), then removing the items from
the right side list box takes for ever because we are removing them one at a
time, which causes the listbox to re-index everything before we remove the
next one. Adding the items using AddRange works very quickly. Does anyone
have any suggestions for quickly removing items from a listbox?
Nov 15 '05 #1
3 3107
This is what the CheckedListBox is for.
Have you tried to Clear the list and call AddRange minus the items you
intend to remove?

Otherwise, I'm sure there's some unmanaged code for this.

HTH;
Eric Cadwell
http://www.origincontrols.com
Nov 15 '05 #2
Jeremy,
In addition to Eric's comments.

Have you considered putting ListBox.BeginUp date & ListBox.EndUpda te around
the code that removes the items?

The help only mentions Add with BeginUpdate, however I would expect it to
work with Remove as equally well...

Hope this helps
Jay

"Jeremy Owens-Boggs" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
We are trying to implement a dual list box selection where you have two list boxes, You highlight items in the right side list box, click a button and
this moves those items over to the left hand list box. The problem is that if there are many items selected (thousands), then removing the items from
the right side list box takes for ever because we are removing them one at a time, which causes the listbox to re-index everything before we remove the
next one. Adding the items using AddRange works very quickly. Does anyone have any suggestions for quickly removing items from a listbox?

Nov 15 '05 #3
Thank you for your input. Using the BeginUpdate and EndUpdate do not speed
up the remove operation, they did remove the anoying 'flicker' when moving
the items. I like the idea of moving to a checked listbox, the big problem
is the sheer number of items in the list box, if it has to reindex each time
an item is removed, it is just going to take to long.

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:uJ******** ********@TK2MSF TNGP09.phx.gbl. ..
Jeremy,
In addition to Eric's comments.

Have you considered putting ListBox.BeginUp date & ListBox.EndUpda te around
the code that removes the items?

The help only mentions Add with BeginUpdate, however I would expect it to
work with Remove as equally well...

Hope this helps
Jay

"Jeremy Owens-Boggs" <an*******@disc ussions.microso ft.com> wrote in message news:%2******** **********@TK2M SFTNGP09.phx.gb l...
We are trying to implement a dual list box selection where you have two list
boxes, You highlight items in the right side list box, click a button and this moves those items over to the left hand list box. The problem is

that
if there are many items selected (thousands), then removing the items from the right side list box takes for ever because we are removing them one at a
time, which causes the listbox to re-index everything before we remove

the next one. Adding the items using AddRange works very quickly. Does

anyone
have any suggestions for quickly removing items from a listbox?


Nov 15 '05 #4

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

Similar topics

23
4009
by: Stan Cook | last post by:
I was trying to take a list of files in a directory and remove all but the ".dbf" files. I used the following to try to remove the items, but they would not remove. Any help would be greatly appreciated. x = 0 for each in _dbases: if each <> ".dbf": del each # also tried: del _dbases x = x + 1 I must be doing something...
0
1637
by: aredo3604gif | last post by:
I have coded a serie of singly linked lists in ANSI C which I have to use. The lists are then stored in a serie of buckets with chained hash table technique. In the various lists there are nodes that carry the same type of data in some of their node fields and some don't. In the various nodes , the struct datatype, there is a flag set to 1...
0
5402
by: Frawls | last post by:
Hi, This is concerned with System.Web.UI.WebControls.DropDownList I am having problems creating a method which will remove list items from a preloaded dropdownlist. This dropdown is loaded when the page loads and the items are pulled from a database. I want to create a method which is called on the page load and will remove certain...
1
1195
by: Glenn M | last post by:
whats the easiest way of removing all items ( regardless or their values) from an asp.net server side dropdown list? thanks glenn
10
6748
by: pamelafluente | last post by:
Hi I have a sorted list with several thousands items. In my case, but this is not important, objects are stored only in Keys, Values are all Nothing. Several of the stored objects (might be a large number) have to be removed (say when ToBeRemoved = true). class SomeObj ToBeRemoved be a boolean field end class
1
2123
by: Macca | last post by:
Hi, My app populates a list of custom objects from data fetched from a database. What i want to do now is filter the list and remove items from the list that don't match the filter criteria. I was thinking of using foreach to traverse the list and dynamically remove items that fail the filter however I am having difficulty removing an...
3
6417
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup of all category items in previous items. In the code this results in a select/options list like this: <SELECT TABINDEX=1...
1
1698
by: mdpems | last post by:
Hi, I have a combo box that is set up to receive items from another from and post as a record set. The items will post to the list as I click an add item button. I also have a remove item button. I also have a total button at the bottom of my screen that when clicked will total the items in the list. What I want to be able to do is retotal the...
7
2811
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds to support cloning: Public Class RefClass Public tcp As TcpClient Public name As String End Class Public Class RefClassList Inherits List(Of...
0
7473
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...
0
7408
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...
0
7661
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. ...
1
7433
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...
0
4949
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...
0
3458
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...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1891
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
1
1020
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.