Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

getItem Method (VBArray) (JavaScript)

Returns the item at the specified location.

safeArray.getItem(dimension1[, dimension2, ...], dimensionN)

safeArray

Required. A VBArray object.

dimension1, ..., dimensionN

Specifies the exact location of the desired element of the VBArray. n equals the number of dimensions in the 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 JavaScript 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 JavaScript code that goes in the <BODY> section to run the other two parts.

<head>
<script type="text/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 type="text/javascript">
<!--
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 type="text/javascript">
<!--
   GetItemTest(CreateVBArray());
-->
</script>
</body>

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, and Internet Explorer 10 standards. Not supported in Windows Store apps. See Version Information.

Applies To: VBArray Object (JavaScript)

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft