Following is an example to add an items or remove an items from a list box.Where form will be opened automatically.First drag and drop an objects as required as follows.
Where developer has chosen two buttons, text box, list box and changed name of those buttons also.
Following is the logic code to perform an action that adding an elements and removing an elements.
Public Class Form1
Private Sub additem_Click(sender As Object, e As EventArgs) Handles additem.Click
lb1.SelectedIndex = lb1.SelectedIndex + 1
Private Sub remove_Click(sender As Object, e As EventArgs) Handles removeitem.Click
Click on start button to compile an application, then the window will be as follows. Where a user can write
an item Names and click on the Add Item
button, then the item will be added to the list box.
Added items will be displayed in the list box as follows.
More items can be added to the list box as follows and when click Remove Item
button the selected item will be deleted.