01.
<%@ Import
Namespace
=
"System.Collections.Specialized"
%>
02.
<%@ Page Language=
"VB"
%>
03.
<script runat=
"server"
>
04.
Sub
Page_Load(sender
As
Object
, e
As
EventArgs)
05.
Dim
objDict
As
StringDictionary
06.
Dim
DicEny
As
DictionaryEntry
07.
Dim
i
As
Integer
08.
09.
objDict =
New
StringDictionary
10.
11.
objDict.Add(
"white"
,
"#FFFFFF"
)
12.
objDict.Add(
"black"
,
"#000000"
)
13.
objDict.Add(
"red"
,
"#FF0000"
)
14.
objDict.Add(
"yellow"
,
"#FFFF00"
)
15.
objDict.Add(
"green"
,
"#00FF00"
)
16.
17.
For
Each
DicEny
In
objDict
18.
Me
.lblText.Text =
Me
.lblText.Text &
"Keys = "
& DicEny.Key &
", Values = "
& DicEny.Value &
"<br>"
19.
Next
20.
21.
End
Sub
22.
</script>
23.
<html>
24.
<head>
25.
<title>ThaiCreate.Com ASP.NET - StringDictionary</title>
26.
</head>
27.
<body>
28.
<form id=
"form1"
runat=
"server"
>
29.
<asp:Label id=
"lblText"
runat=
"server"
></asp:Label>
30.
</form>
31.
</body>
32.
</html>