Public Class Form1
Dim WithEvents lstItems As New ListBox
Dim strone As String = "Item One"
Dim strtwo As String = "Item Two"
Dim strthree As String = "Item Three"
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lstItems.Location = New Point(82, 5)
lstItems.Items.Add(strone)
lstItems.Items.Add(strtwo)
lstItems.Items.Add(strthree)
Me.Controls.Add(lstItems)
End Sub
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
lstItems.SelectedIndex = 0
End Sub
Private Sub btnTwo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTwo.Click
lstItems.SelectedIndex = 1
End Sub
Private Sub btnThree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThree.Click
lstItems.SelectedIndex = 2
End Sub
End Class
Monday, February 14, 2011
Assignment Three - Question Four
Create a form with three buttons and a listbox. Upon loading put three items in the listbox so it is not empty. Make button one selct item one, button two select item two, and button three select item three.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment