Imports System.Collections Imports System Imports Microsoft.VisualBasic Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Dim myHT As New Hashtable() myHT.Add("First","Hello") myHT.Add("Second","World") myHT.Add("Third","!") '''''''''''''''''''显示'''''''''''''' Dim myEnumerator As IDictionaryEnumerator = myHT.GetEnumerator() TextBox1.Text = ControlChars.Tab + "-KEY" + ControlChars.Tab + "-VALUE" While myEnumerator.MoveNext() ListView1.Items.Add(ControlChars.Tab + myEnumerator.Key + ControlChars.Tab + myEnumerator.Value) End While End Sub End Class
运行效果截图:
原文链接:https://www.f2er.com/vb/258382.html