Solved

Ubound of second element in a 2-dimensional array

Posted on 2006-10-27
6
1,208 Views
Last Modified: 2008-02-01
In VB6, is there a way to find the ubound of the second element in a 2-d array?

For instance, if I had an array dimensioned like this:  sName(0 to 50, 0 to 100)
and I wanted to later get Ubound(sName)  how do I get the 100 value?

thanks!
0
Comment
Question by:LovinSpoonful
  • 3
  • 2
6 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 17822742
Hi LovinSpoonful,

UBound(NameOfArray, DImensionNumber)

Regards,

Patrick
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17822744
LovinSpoonful,

In your case:

UBound(sName, 2)

Regards,

Patrick
0
 
LVL 12

Expert Comment

by:jkaios
ID: 17831767
The UBound() function has two parameters:  The first one the "name" of the array variable; and the second one is the "dimension" parameter (which is optional) and is a whole number indicating which dimension's upper bound is returned.  And because the second param is optional, if omitted, 1 is assumed.

Therefore:

  UBound(sName) ... will return 50  = which is the same as UBound(sName, 1)

In your case:

  See Patrick's example.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:LovinSpoonful
ID: 17861931
Gee, I feel foolish...
0
 

Author Comment

by:LovinSpoonful
ID: 17861938
Thanks alot for your help.
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17865991
> Gee, I feel foolish...

No need for that, we're all learning here :)

> Thanks alot for your help.

You're most welcome.

Patrick
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now