View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal[_2_] Robert Crandal[_2_] is offline
external usenet poster
 
Posts: 158
Default Use a listbox as a dynamic array?

"GS" wrote

I've ALWAYS found using dynamic arrays much easier to manage, AND get way
better performance than read/write to a control or worksheet. IOW, your
logic (IMO) for using hidden listboxes is flawed because that's way more
complex than just managing the arrays you populate them with. You need to
keep track of which listbox contains what data same as you'd have to keep
track of which array contains what data. Listbox indexes start at zero;
dynamic 2D arrays of ranges start at 1. This adds to management
complexity.


I thought I read somewhere that it was not possible to resize an array that
already contains data. I could be wrong about this.

I was initially thinking about creating two or three separate arrays, each
containing sized at 6000 elements, and then add or delete data as necessary.
I was thinking this might be a slightly inefficient approach, so I
considered
the idea of using a Listbox as an array that can grow when necessary.

My program already requires one Listbox that will be visible. I thought
about creating one or two separate hidden Listbox controls that will
be parallel to the visible Listbox (meaning the Listboxes are the same size
and each index corresponds to each other according to my program).
It seemed like an easy to manage method to me, because all I need to do
is call AddItem() for each Listbox, one at a time, and it eliminated the use
of global arrays that require dynamic resizing and whatever.