count elements in an array

  • Thread starter Thread starter thomasp
  • Start date Start date
T

thomasp

If I have an array declared as Dim aryTargets(99) as integer, can I get the
count of how many of the elements actually are filled without looping
through the array and testing the value of each element of the array?

Thanks,

Thomas
 
If I have an array declared as Dim aryTargets(99) as integer, can I get
the
count of how many of the elements actually are filled without looping
through the array and testing the value of each element of the array?

Yep, the array doesn't provide a built-in mechanism to check how many items
(don't) have a certain value.
 
Thomas,
If I have an array declared as Dim aryTargets(99) as integer, can I get
the
count of how many of the elements actually are filled without looping
through the array and testing the value of each element of the array?
Why do you use a fixed array if it is not completely filled. Is than an
arraylist a better choice

Just a thought,

Cor
 
I don't know the difference, but I will read up on the two. An arraylist
may be the better choice for me.

Thanks,

Thomas
 
Back
Top