VB.NET中IDictionaryEnumerator使用示例

前端之家收集整理的这篇文章主要介绍了VB.NET中IDictionaryEnumerator使用示例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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

运行效果截图:

猜你在找的VB相关文章