This is code show how to set integer, decimal,and string data types:
1: Dim Apples As Integer 2: Dim bible As Decimal 3: Dim corral As String
1: Dim Apples As Integer 2: Dim bible As Decimal 3: Dim corral As String
Public Class frmTestArrayHash
Dim queueList As New Queue
Dim weeks As New Hashtable
Dim sport As ArrayList
Private Sub btnHashTable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHashTable.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.Value)
Next
End Sub
Private Sub btnArrayList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnArrayList.Click
Dim sport(5) As String
Dim i As Integer
sport(0) = "Soccer"
sport(1) = "Cricket"
sport(2) = "Rugby"
sport(3) = "Aussie Rules"
sport(4) = "BasketBall"
sport(5) = "Hockey"
For i = 0 To sport.Length - 1
MessageBox.Show("The sport you chose is " & sport(i))
Next
'displaying value from array
End Sub
Private Sub btnQueue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQueue.Click
Dim vince As String
queueList.Enqueue("Sun")
queueList.Enqueue("Mon")
queueList.Enqueue("Tue")
queueList.Enqueue("Wed")
queueList.Enqueue("Thu")
queueList.Enqueue("fri")
queueList.Enqueue("Sat")
Do While queueList.Count > 0
vince = queueList.Dequeue
MsgBox(vince)
Loop
End Sub
End Class