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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning the size of an array?

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
I have a function that ReDims an array. I then want to use the array in another function so I need to find, in some way, the size of this array.

Cant find anything in help.

Any ideas?

Cheers elziko
 
UBound(ArrayName) will return the highest index number in the array. LBound(ArrayName) returns the starting index. Ruairi
ruairi@logsoftware.com
Experienced with:

VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions

ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications
 
If you are using the UBound and LBound functions you need to use them as follows:

Code:
intSize = (UBound(arrMyArray) - LBound(arrMyArray)) + 1

If you don't add one to the result you will get an array size back one to small!

james :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top