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

ArrayList as ListBox.DataSource

My problem occurs when I use an ArrayList as a ListBox.DataSource. When the
ArrayList attached to the Listbox is not empty the Listbox behave normal
without problem, but if I remove all items from the ArrayList and re-attach
the ArrayList to the ListBox the program hangs for about 3-5 seconds then
keep running normal.

I'm following the examples from the MSDN and dont see anything abnormal.
This is a sample of the code I'm using:

1 IList codesA = (IList)lstOfGroupAccessCodes.DataSource;
2 IList codesB = (IList)lstOfCodesNotInGroup.DataSource;
3 Object selectedItem = lstOfGroupAccessCodes.SelectedItem;

4 codesA.Remove(selectedItem);
5 lstOfGroupAccessCodes.DataSource = null;

6 lstOfGroupAccessCodes.DataSource = codesA;

7 lstOfCodesNotInGroup.DataSource = null;
8 codesB.Add(selectedItem);
9 lstOfCodesNotInGroup.DataSource = codesB;

The program hangs on line 6 for about 3-5 seconds when I remove the last
item of the ArrayList ( codesA.Count == 0 )

--


Jesse Martinez
Systems Developer

Multisystems, Inc
Capital Center South Tower 801
San Juan, PR, 00918
1-787-751-2720 x.231

This message may contain proprietary information intended only for it's
recipient. If you are not the intended recipient, you are hereby notified
that any disclosure, copying, or distribution of the contents of this e-mail
is strictly prohibited. If you have received this e-mail transmission in
error, please reply to the sender, so that Multisystems can arrange for
proper delivery, and then please delete the message from your inbox. Thank
you.
Nov 15 '05 #1
0 4579

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

Similar topics

2
by: Fieldmedic | last post by:
I'm attempting to get an arraylist to display in a Listbox (listbox2). The arraylist is created from selections in a different listbox (listbox1). The 1st listbox has a selection mode of...
4
by: Jason | last post by:
Here is an odd issue. I am trying to shed some light on why this is causing a problem. I have an ArrayList. I am binding it to a ListBox control with has its Sort property set to True. If the...
13
by: Larry Woods | last post by:
I am creating a "from-to" set of listboxes where the "left" listbox had a list of values and I want to be able to select these values, 1 at a time, and move them into a "right" listbox, removing...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
16
by: Michael C# | last post by:
I'm binding a Combobox to an Arraylist, and I'd like to set the ValueMember and DisplayMember properties of the Combobox. Is this possible, or do I need to bind to a DataTable? Thanks
5
by: John Veldthuis | last post by:
My code works perfectly 100% when adding items to my ArrayList and updating the listbox. Works perfectly when deleting an item in the ArrayList when it is not the last entry but if it is the last...
2
by: AppleBag | last post by:
Hello everybody, I am beginning the .NET learning curve, and I have learned how to load a listbox with a directory list of files using this code: If FolderBrowserDialog1.ShowDialog() =...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.