Solved

Ubound of second element in a 2-dimensional array

Posted on 2006-10-27
6
1,213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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