- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

As i know, the value of Lbound for any dimension of array will be zero. So what is the use of it.

I did searching and found out below point, where Lbound found as useful but i didnt understand it.

I would appriciate if someone can explain it to me.

1. Use the LBound function with the UBound function to determine the size of an array.

My question: we can directly use Ubound +1 to get size of an array. what is the mean of above statement?

2. In below code snnipet,

Dim costsLB1 As Integer

Dim costsLB2 As Integer

costsLB2 = LBound( costs, 2 )

' Now, costsLB1 = 0 and costsLB2 = 1.

My question: what type of array is this (code highlighted in red)? can we declare array like this?

Regards,

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Lbound, gives you the lower dimension of the array. synatax is lbound( arrayname, dimension)

The example you have provided is used in VBA

By default the lbound for any array is 0, but in the example you have provided

Dim costs(0 to 10, 1 to 100) As Double => this is a two dimension array

the lbound(Costs,1) is 0 => the lower bound for the first dimension in the cost array

the ubound(Costs,1) is 10 => the ubound for the first dimension in the cost array

the lbound(Costs,2) is 1 => the lower bound for the second dimension in the cost array

the ubound(Costs,2) is 100 => the upper bound for the second dimension in the cost array

Hope this helps. You cannot use this in UFT.

GoScriptLESS(support@scriptlessautomation.com)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

hi, there

the syntax is not supported in UFT. It could be just VB, not VBS. I also searched and found the below link:

https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/lbound-function

There you can also see the usage of LBound as the array can be started from non-zero.

Thanks.

James

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Lbound, gives you the lower dimension of the array. synatax is lbound( arrayname, dimension)

The example you have provided is used in VBA

By default the lbound for any array is 0, but in the example you have provided

Dim costs(0 to 10, 1 to 100) As Double => this is a two dimension array

the lbound(Costs,1) is 0 => the lower bound for the first dimension in the cost array

the ubound(Costs,1) is 10 => the ubound for the first dimension in the cost array

the lbound(Costs,2) is 1 => the lower bound for the second dimension in the cost array

the ubound(Costs,2) is 100 => the upper bound for the second dimension in the cost array

Hope this helps. You cannot use this in UFT.

GoScriptLESS(support@scriptlessautomation.com)