[thelist] Visual Basic 6.0 - Iterating through Collections... .

Scott Dexter sgd at ti3.com
Tue Nov 14 16:24:27 CST 2000


Actually, that gets the Key. One more step and you have it:

	varKeyValue= dictCategory(CatItem)


>    For Each CatItem In dictCategory
>       ' This will get the "Item" from the Collection
>       varFunctName = CatItem
>       ' How do I get the "Key"
	' *** YOU JUST DID ****

	' Now get the Item
	varFunctValue= dictCategory(CatItem)
	
>    Next

Here's the example that I remembered to grab Keys and Values out of a
collection (note the obscure place)

<TABLE BORDER="1">
<TR><TD><B>Server Variable</B></TD><TD><B>Value</B></TD></TR>
<% For Each strKey In Request.ServerVariables %> 
<TR><TD> <%= strKey %> </TD><TD>  <%= Request.ServerVariables(strKey) %>
</TD></TR>
<% Next %>
</TABLE>

That's right, I originally found it looking up Request.ServerVariables. Go
figure.

Lemme know if this ain't doin it forya--
sgd




More information about the thelist mailing list