ASP Key 属性

คำอธิบายและวิธีใช้

Key 属性ใน Dictionary ที่มี key อยู่แล้วตั้งค่าค่าใหม่。

รูปแบบใช้งาน:

DictionaryObject.Key(key)=newkey
Parameter Description
key สำคัญ。ชื่อ key ที่ต้องการแก้ไข。
newkey สำคัญ。ชื่อใหม่ของ key。

ตัวอย่าง

<%
Dim d
Set d=Server.CreateObject("Scripting.Dictionary")
d.Add "re","แดง"
d.Add "gr","เขียว"
d.Add "bl","Blue"
d.Add "pi","Pink"
d.Key("re")="r"
Response.Write("ค่าของกุญแจ r คือ: " & d.Item("r"))
%>

การออกผลลัพธ์:

ค่าของกุญแจ r คือ: Red