This documentation is archived and is not being maintained.

dimensions Method

Returns the number of dimensions in a VBArray.

function dimensions() : Number


The dimensions method provides a way to retrieve the number of dimensions in a specified VBArray.

The following example consists of three parts. The first part is VBScript code to create a Visual Basic safe array. The second part is JScript code that determines the number of dimensions in the safe array and the upper bound of each dimension. Both of these parts go into the <HEAD> section of an HTML page. The third part is the JScript code that goes in the <BODY> section to run the other two parts.

Function CreateVBArray()
   Dim i, j, k
   Dim a(2, 2)
   k = 1
   For i = 0 To 2
      For j = 0 To 2
         a(j, i) = k
         k = k + 1
   CreateVBArray = a
End Function

function VBArrayTest(vba)
   var i, s;
   var a = new VBArray(vba);
   for (i = 1; i <= a.dimensions(); i++)
      s = "The upper bound of dimension ";
      s += i + " is ";
      s += a.ubound(i)+ ".<BR>";

<SCRIPT language="jscript">


Version 3

See Also

getItem Method | lbound Method | toArray Method | ubound Method

Applies To: VBArray Object