Sign in to follow this  

Visual Basic 6 array

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have a function that returns a 2 dimensional array. How would i be able to check how many items are in the first element? the 2D array returns a certain number of points. ie: value(0,0) - x value for 1st point value(0,1) - y value for 1st point value(0,2) - z value for 1st point value(1,0) - x value for 2nd point etc... how would i be able to test the value to see if say there are a certain number of point. say i need to do if value has 5 points then for i = 0 to 4 do something with value(i,0) do something with value(i,1) do something with value(i,2) next i end if

Share this post


Link to post
Share on other sites
someone told me to do

on error resume next
then when i set a value for that point check to see if there's an error
if err.number = 0 then there is a point and continue, but there has to be a way to avoid errors, right?

if there's no other way i suppose doing that couldn't hurt...

Share this post


Link to post
Share on other sites
ubound has a second optional argument that is the dimension you want to check - so for example:
for i = lbound(value, 1) to ubound(value, 1)
for j = lbound(value, 2) to ubound(value, 2)
do something with value(i,j)
next j
next i
end if

Share this post


Link to post
Share on other sites

This topic is 4356 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this