Hashtable.Remove Method removes the element with the specified key from the Hashtable.
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Public Class SamplesHashtable
Public Shared Sub Main()
Dim myHT As New Hashtable()
myHT.Add("1a", "The")
myHT.Add("1b", "quick")
myHT.Add("1c", "brown")
PrintKeysAndValues(myHT)
myHT.Remove("1a")
PrintKeysAndValues(myHT)
End Sub
Public Shared Sub PrintKeysAndValues(myHT As Hashtable)
Dim de As DictionaryEntry
For Each de In myHT
Console.WriteLine(" {0}: {1}", de.Key, de.Value)
Next de
End Sub
End Class
Related examples in the same category