Dim printJobs As New Queue
Private Sub btnSendJob_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendJob.Click
Dim printer As New Hashtable
printer.Add("Title", (txtTitle.Text))
printer.Add("Pages", (cbPages.Text))
printJobs.Enqueue(printer)
lstJobs.Items.Clear()
For Each h As Hashtable In
printJobs
lstJobs.Items.Add(h.Item("Title") & " " & (h.Item("Pages")))
Next
txtTitle.Text = ""
Me.cbPages.Items.Remove("")
End Sub
Private Sub btnClearCurrent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearCurrent.Click
lstJobs.Items.Clear()
End Sub
End Class
In this example i am going to demonstrate how to create an array that will store users; Name(first and last), and Email address.
Dim Names As New Hashtable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Names(1) = (txtFirstName.Text)
Names(2) = (txtLastName.Text)
Names(3) = (txtEmail.Text)
txtEmail.Clear()
txtFirstName.Clear()
txtLastName.Clear()
End Sub
Private Sub btnFirstName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirstName.Click
MsgBox(Names(1))
End Sub
Private Sub btnLastName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLastName.Click
MsgBox(Names(2))
End Sub
Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
MsgBox(Names(3))
End Sub
End Class
No comments:
Post a Comment