How to remove selected item in ListBox? - Visual Basic 2017

Hot

Thursday, October 26, 2017

How to remove selected item in ListBox?

In Visual Basic 2017 to remove selected item in ListBox is the same as in the previous releases in Visual Basic Net editions.

To solve this problem I putted a listbox in the form and two button. The first button is actually to add items in the listbox.
Here is the code for the first button:

ListBox1.Items.Add("some text")

The second button is the "Remove" button, as on the picture bellow.

ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)

How to remove selected item in ListBox?

No comments:

Post a Comment