The ASP Dictionary Object, the example below:
<%
'//Criando o dicionário
Dim d
Set d = CreateObject("Scripting.Dictionary")
'//Adicionando os itens
d.Add "re","Red"
d.Add "gr","Green"
d.Add "bl","Blue"
d.Add "pi","Pink"
'//Recuperando e imprimindo valores
dim a,c
a = d.Keys
c = d.items
for i=0 to d.Count-1
Response.Write(a(i) + " " + c(i))
Response.Write("<br>")
next
%>
If you still want to print with For each
can be done like this:
For each item in d.Keys
Response.Write(item + " " + d.Item(item))
Response.Write("<br>")
Next
and to change some value, must be informed the key and the new value, example:
if (d.Exists("re")) then '// verificando se a chave existe
d.Item("re") = "new valor" '// alterando valores
end if
this also follows the same model to exclude, example:
if (d.Exists("re")) then '// verificando se a chave existe
d.Remove("re") '// excluindo item
end if
to remove all items:
d.RemoveAll
References: