Public Class Form1
Public Class Form1
Dim User As New Hashtable
Private Sub btnUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUser.Click
User.Clear()
User.Add("FirstName", txtFirst.Text)
User.Add("LastName", txtLast.Text)
User.Add("Email", txtEmail.Text)
txtFirst.Clear()
txtLast.Clear()
txtEmail.Clear()
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click
MsgBox(User.Item("FirstName"))
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click
MsgBox(User.Item("LastName"))
End Sub
Private Sub btnEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmail.Click
MsgBox(User.Item("Email"))
End Sub
End Class
Wednesday, March 30, 2011
Hashtables in Visual Basic - Arrays Assignment Number 2
2. Create a form with textboxes for the following:-first name-last name-email. Add labels to describe each box.Add a button for adding the user. The add user button click event will do the following: -add the user information into a hashtable -clear the text from the text boxes. We want to add the information into the hashtable using three keys: FirstName, LastName, Email. Add First Name, Last Name, and Email buttons to the bottom of the form. Each of these buttons is going to fire off a message box that will show the information that was just added in.
Labels:
hashtable,
visual basic
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment