Hash Table In Vb.net

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Hash Table In Vb.net as PDF for free.

More details

  • Words: 215
  • Pages: 2
HashTable stores a Key Value pair type collection of data . We can retrive items from hashTable to provide the key . Both key and value are Objects. The common functions using in Hashtable are :

Add : To add a pair of value in HashTable Syntax : HashTable.Add(Key,Value) Key : The Key value Value : The value of corrosponding key ContainsKey : Check if a specified key exist or not Synatx : HashTable.ContainsKey(key) Key : The Key value for search in HahTable ContainsValue : Check the specified Value exist in HashTable Synatx : HashTable.ContainsValue(Value) Value : Search the specified Value in HashTable Remove : Remove the specified Key and corrosponding Value Syntax : HashTable.Remove(Key) Key : The argument key of deleting pairs The following source code shows all important operations in a HashTable VB.NET SourceCode Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim weeks As New Hashtable Dim day As DictionaryEntry weeks.Add("1", "Sun") weeks.Add("2", "Mon") weeks.Add("3", "Tue") weeks.Add("4", "Wed") weeks.Add("5", "Thu")

weeks.Add("6", "Fri") weeks.Add("7", "Sat") 'Display a single Item MsgBox(weeks.Item("5")) 'Search an Item If weeks.ContainsValue("Tue") Then MsgBox("Find") Else MsgBox("Not find") End If 'remove an Item weeks.Remove("3") 'Display all key value pairs For Each day In weeks MsgBox(day.Key " -- " day.Value) Next End Sub End Class

Related Documents

Vbnet
June 2020 24
Hash
May 2020 6
Vbnet
June 2020 26
Hash Code
June 2020 5