際際滷

際際滷Share a Scribd company logo
Dr. Girija Narasimhan 1
Part 10- LIST BOX
Dr. Girija Narasimhan 2
Dr. Girija Narasimhan 3
'Remove  it will remove only textbox1. Text information from listbox1 not listbox1 items
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ListBox1.Items.Remove(TextBox1.Text)
End Sub
'remove_all it will remove all the listbox1 items from listbox1
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
ListBox1.Items.Clear()
End Sub
' If you place the cursor in the listbox1 particular item- it will remove only that item
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ListBox1.SelectedIndexChanged
'ListBox1.Items.Remove(ListBox1.Text)
End Sub
Dr. Girija Narasimhan 4
'which item in the listbox if you click that will paste in the textbox2
Private Sub listbox1_click(sender As Object, e As EventArgs) Handles ListBox1.Click
TextBox1.Text = ListBox1.SelectedItem
End Sub
'if you doubleclick the selected item in the listbox it will remove
Private Sub listbox1_doubleclick(sender As Object, e As EventArgs) Handles
ListBox1.DoubleClick
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
End Class

More Related Content

Part 10 listbox using vb.net

  • 1. Dr. Girija Narasimhan 1 Part 10- LIST BOX
  • 3. Dr. Girija Narasimhan 3 'Remove it will remove only textbox1. Text information from listbox1 not listbox1 items Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ListBox1.Items.Remove(TextBox1.Text) End Sub 'remove_all it will remove all the listbox1 items from listbox1 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click ListBox1.Items.Clear() End Sub ' If you place the cursor in the listbox1 particular item- it will remove only that item Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged 'ListBox1.Items.Remove(ListBox1.Text) End Sub
  • 4. Dr. Girija Narasimhan 4 'which item in the listbox if you click that will paste in the textbox2 Private Sub listbox1_click(sender As Object, e As EventArgs) Handles ListBox1.Click TextBox1.Text = ListBox1.SelectedItem End Sub 'if you doubleclick the selected item in the listbox it will remove Private Sub listbox1_doubleclick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick ListBox1.Items.Remove(ListBox1.SelectedItem) End Sub End Class