Share via


getItem Method

Returns the item at the specified location in a VBArray object.

function getItem(dimension1 : Number [, ...], dimensionN : Number) : Object

Arguments

  • dimension1, ..., dimensionN
    Specifies the exact location of the desired element of the VBArray. The number of arguments must match the number of dimensions in the VBArray.

Example

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 iterates the Visual Basic safe array and prints out the contents of each element. 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.

<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Function CreateVBArray()
   Dim i, j, k
   Dim a(2, 2)
   k = 1
   For i = 0 To 2
      For j = 0 To 2
         a(i, j) = k
         document.writeln(k)
         k = k + 1
      Next
      document.writeln("<BR>")
   Next
   CreateVBArray = a
End Function
-->
</SCRIPT>
<SCRIPT LANGUAGE="JScript">
<!--
function GetItemTest(vbarray)
{
   var i, j;
   var a = new VBArray(vbarray);
   for (i = 0; i <= 2; i+)
   {
      for (j =0; j <= 2; j+)
      {
         document.writeln(a.getItem(i, j));
      }
   }
}
-->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JScript">
<!--
   GetItemTest(CreateVBArray());
-->
</SCRIPT>
</BODY>

Requirements

Version 1

Applies To:

VBArray Object

See Also

Reference

dimensions Method

lbound Method

toArray Method

ubound Method

Change History

Date

History

Reason

March 2009

Modified example code.

Content bug fix.