‘Get all the keys into an array
arrItems = objMyData.Items ‘Get all the items into an array
For intLoop = 0 To objMyData.Count ?1 ‘Iterate through the array
StrThisKey = arrKeys(intLoop) ‘This is the key value
StrThisItem = arrItems(intLoop) ‘This is the item (data) value
Next
// In JScript
// Get VB-style arrays using the Keys() and Items() methods
var arrKeys = new VBArray(objMyData.Keys()).toArray();
var arrItems = new VBArray(objMyData.Items()).toArray();
for (intLoop = 0; intLoop < objMyData.Count; intLoop++) {
// Iterate through the arrays
strThisKey = arrKeys[intLoop]; // This is the key value
strThisItem = arrItems[intLoop]; // This is the item (data) value
}
在VBScript里也可以使用For Each … Next语句完成同样的功能:
‘ Iterate the dictionary as a collection in VBScript
For Each objItem in arrItems
Response.Write objItem & “ = “ & arrItems(objItem) & “<BR>”
Next
arrItems = objMyData.Items ‘Get all the items into an array
For intLoop = 0 To objMyData.Count ?1 ‘Iterate through the array
StrThisKey = arrKeys(intLoop) ‘This is the key value
StrThisItem = arrItems(intLoop) ‘This is the item (data) value
Next
// In JScript
// Get VB-style arrays using the Keys() and Items() methods
var arrKeys = new VBArray(objMyData.Keys()).toArray();
var arrItems = new VBArray(objMyData.Items()).toArray();
for (intLoop = 0; intLoop < objMyData.Count; intLoop++) {
// Iterate through the arrays
strThisKey = arrKeys[intLoop]; // This is the key value
strThisItem = arrItems[intLoop]; // This is the item (data) value
}
在VBScript里也可以使用For Each … Next语句完成同样的功能:
‘ Iterate the dictionary as a collection in VBScript
For Each objItem in arrItems
Response.Write objItem & “ = “ & arrItems(objItem) & “<BR>”
Next