Monday, December 17, 2007

How to delete the information in a Dictionary

How to delete the information in a Dictionary

S T E P - 1

- We can delete the item in a Dictionary:

<%

Set objDir = CreateObject("Scripting.Dictionary")

objDir.Add "Key1", "This is first value"

objDir.Add "Key2", "This is second value"

strItem = objDir.Remove("Key1") 'remove the item, but we store in the strItem variable

%>

S T E P - 2

- We also can remove all items in a Dictionary.

<%

Set objDir = CreateObject("Scripting.Dictionary")

objDir.Add "Key1", "This is first value"

objDir.Add "Key2", "This is second value"

objDir.RemoveAll

%>

No comments: