Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you find the sizr of an array?

Status
Not open for further replies.

FrankD

Programmer
Aug 13, 1999
8
US
Is there a simple way to find the size of an array? I am trying to write code to remove an item from it, and need to check my code to see if I am doing it right. Any help is appreciated, thanks.<br>
<br>
Frank
 
Find the number of elements with ElementsInArray = Ubound(NameOfArray). Finding the number of bytes in an array is only slightly trickier.
 
Alt225 -<br>
I'm assuming this is starting at 0? Like, if ElementsInArray = 2, it means that there are 3 entries? If so then it works great, and thanks for the help! :)<br>
<br>
Frank
 
Thanks for mentioning that. Since the lower boundry of the array can be almost any number less than or equal to the upper boundry I should have said Ubound(NameOfArray) - Lbound(NameOfArray) + 1.
 
Hi frankD,<br>
If you want each array in your program to have 1 as the base then write this code in the general declaration <br>
Option base=1<br>
<br>
It will apply the basevalue 1 to every array in your specific module.<br>
<p>Ravi Kochher<br><a href=mailto:rkochher@velos.ssind.com>rkochher@velos.ssind.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top