Message 1 of 26
How to fill a dynamic array?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an application that:
I am still a bit green with VBA… this is only my first application… but so far (slowly) so good!
Put as short as is possible, the application …
Activates currently open documents...
Within each dwg...
... the app builds a select set of closed polygonal block (3 or 4 or so) ...
Then parses through each closed polygonal block...
and gets other block references (10 to 34 or more) that are positioned within
them. The collected multiple blocks are sorted by polygonal block’s OCS. The sorted block's number attribute value is incremented starting from the first dwg to the last open dwg.
After all the dwgs are activated and the objects are processed... I want to fill a ListView control with collected data... where each block is represented as a row in the ListView control. Each row in the ListView control will be filled with (8 columns) as follows:
Cnt#AttribVal1, AttribVal2, AttribVal3, Lgth, Wdth, Dpth, Handle, Document
… So… Obviously, I know how many columns there are, but I don’t know until all is process how many objects there will be … there could be several hundred and for larger projects perhaps a thousand or more…
As I understand it … you can ReDim ONLY the upper bound of the last dimension last dimension of the dynamic array… so, … how might I approach this such to collect all the data where the rows may vary (as many as a thousand worst case perhaps), then fill the ListView control after all the data is collected?
Also, I think I’ve experimented enough with the ListView control, and I now know how to fill it … also, it looks that once filled, the control itself holds the data and the variable doesn’t have to be maintained, instead I can retrieved the data straight from the control itself… therefore perhaps I only need to populate a dynamic array for each drawing processed, then put the data into the control… then process the next drawing and reuse the dynamic array.
So I guess to summarize my questions are two:
1). How can I define a two dimensional dynamic array that can grow to hold variable records/rows and 8 columns?
2). Would it best to collect all the data and fill the ListView afterwards… or input the data into the ListView control after each drawing has been processed?
I am still a bit green with VBA… this is only my first application… but so far (slowly) so good!
Put as short as is possible, the application …
Activates currently open documents...
Within each dwg...
... the app builds a select set of closed polygonal block (3 or 4 or so) ...
Then parses through each closed polygonal block...
and gets other block references (10 to 34 or more) that are positioned within
them. The collected multiple blocks are sorted by polygonal block’s OCS. The sorted block's number attribute value is incremented starting from the first dwg to the last open dwg.
After all the dwgs are activated and the objects are processed... I want to fill a ListView control with collected data... where each block is represented as a row in the ListView control. Each row in the ListView control will be filled with (8 columns) as follows:
Cnt#AttribVal1, AttribVal2, AttribVal3, Lgth, Wdth, Dpth, Handle, Document
… So… Obviously, I know how many columns there are, but I don’t know until all is process how many objects there will be … there could be several hundred and for larger projects perhaps a thousand or more…
As I understand it … you can ReDim ONLY the upper bound of the last dimension last dimension of the dynamic array… so, … how might I approach this such to collect all the data where the rows may vary (as many as a thousand worst case perhaps), then fill the ListView control after all the data is collected?
Also, I think I’ve experimented enough with the ListView control, and I now know how to fill it … also, it looks that once filled, the control itself holds the data and the variable doesn’t have to be maintained, instead I can retrieved the data straight from the control itself… therefore perhaps I only need to populate a dynamic array for each drawing processed, then put the data into the control… then process the next drawing and reuse the dynamic array.
So I guess to summarize my questions are two:
1). How can I define a two dimensional dynamic array that can grow to hold variable records/rows and 8 columns?
2). Would it best to collect all the data and fill the ListView afterwards… or input the data into the ListView control after each drawing has been processed?