![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Help!,
How can i clear an Arraylist? i use Listbox3.Clear FileSearch (al1, appPath, "*.csv") For i = 0 to al1.Count - 1 ListBox3.Add(FileName(al1.Item(i))) Next End Sub I need serveral times to reload above situations in an listbox, the listbox can be cleared but the Arraylist not? Last edited by tvrman : 06-29-2007 at 09:45 PM. |
|
|||
|
Hi Erel,
I take benefit of this new subject about Arraylists to ask if there is a way to dispose Arraylists objects added at runtime ? In fact, if i add a button to a form with the AddButton method then dispose and add it again, there is no problem. But doing the same with an arraylist raises an error. eg.: ' working code AddButton("Form1","myButton",10,10,50,20,"Test") msgbox("button added") control("myButton").dispose msgbox("button disposed") AddButton("Form1","myButton",10,10,50,20,"Test") msgbox("button added again") ' not working code AddArrayList("myList") msgbox("arraylist added") control("myList").dispose msgbox("arraylist disposed but in fact not really ")AddArrayList("myList") msgbox("well error on above line") Well it is still possible to clear the arraylist and add an error handler when trying to add one but i only wanted to know if this was a normal/wanted behaviour. Thanks in advance. ps: I attached some code example to illustrate ![]() This example also shows how to use a hidden disposable listbox control to mimic the arraylist behaviour. The drawbacks of this is we need a form to add the listbox to and the list cannot be sorted automatically with a 'sort method' :/ There may be other drawbacks not mentionned or just forgotten here ![]() |
|
||||
|
If you are going to use the same arraylist then try just to clear it...
You can check that an array list already exist by trapping the error generated upon trying to re-create it... like this errorlabel(error) addarraylist(myarray) ' if myarray already exist it jumps to error return ' stops the execution of the remaing code of the sub error: do whatever you like, possably create "myarray2"
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
|||
|
To CableGuy, yep, we need to use errorlabel not to get the error message.
To RandomCoder, the dispose method does not appear in the help file but seems to exist anyway ![]() If you add one arraylist manually with the form editor then in the code you tap "arraylist1." to see the possible methods you will notice the dispose one. Is this only a method provided by a generic interface with no implementation behind or why in any other case does this method seem to be available ? Thanks for your replies ![]() Regards, Sirnono |
|
||||
|
This would appear to be a bug and so I'll add it to the 'Bugs and Errors' section of the Forum.
It should either be made available as a Method or removed from the list. Regards, RandomCoder.
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD. Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD. "Defeat never comes to any man until he admits it."Josephus Daniels |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ArrayList bidimensional? | serge | Questions & Help Needed | 3 | 07-18-2008 10:15 AM |
| ArrayList | Bobbes | German Forum | 2 | 02-25-2008 09:36 PM |
| ControlType for ArrayList | glook | Bug Reports | 2 | 02-18-2008 11:31 AM |
| ArrayList won't dispose? | willisgt | Questions & Help Needed | 1 | 08-30-2007 08:56 PM |
| listbox = arraylist ? | sloopa | Questions & Help Needed | 1 | 05-07-2007 01:38 PM |