Arraylist disposal
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