How to Remove Items in a Listbox in VB.NET

Written by jaime avelar
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Remove Items in a Listbox in VB.NET
Add data to a list box dynamically in Visual Basic. (Chad Baker/Ryan McVay/Photodisc/Getty Images)

Giving the user the flexibility to remove items they're not going to use in a list box control can make your VB.NET application more user-friendly. In VB, you can use the "Items" property to add, remove, or obtain a reference to the items in the list box control. The "SelectedIndex" property gives you the index of the currently selected item. The "RemoveAt" method will remove the currently selected item from the list box.

Skill level:
Moderately Easy


  1. 1

    Launch Microsoft Visual Basic Express, click "New Project..." on the left pane of your screen and double-click "Windows Forms Application" to start a new project.

  2. 2

    Double-click "ListBox" on the Toolbox pane to add a new list box control. Add a button by double-clicking "Button" on the toolbox.

  3. 3

    Double-click the form to create a form load event and add the following code to add three items to the list box:


  4. 4

    Double-click "Button1" to create a click event for the button. Type the following code to remove the selected item when the button is clicked:


  5. 5

    Press "F5" to run the program. Select an item from the list box. Click "Button1" to remove it.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.