Open In App

ASP Item Property

The ASP Item Property is used to return or set the value of an item in the Dictionary Object.

Syntax:



DictionaryObject.Item(key)[=newitem]

Parameter Values:

Example: The below code demonstrates the ASP Dictionary.Item Property.






<%
Dim dict
  
'Create a new dictionary
Set dict=Server.CreateObject("Scripting.Dictionary")
  
'Add values to the dictionary
dict.Add "g","green"
dict.Add "r","red"
dict.Add "p","purple"
  
'Getting a value from the dictionary
Response.Write("Value of key 'p' is: " & dict.Item("p"))
  
'Setting a new value to the key
dict.Item("p") = "violet"
  
'Getting the value again from the dictionary
Response.Write("<br>Value of key 'p' is: " & dict.Item("p"))
%>

Output:

Value of key 'p' is: purple
Value of key 'p' is: violet
Article Tags :