I am trying to make an app in Visual Basic that allows an user to type in text and add it to the list as well as remove items from the list. My problem so far is that I can't remove the items, I can add them, just not remove them. My code is as follows:
Public Class Form1
Public Listed As String
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Prompt As String = "Enter Items To Add Here"
Listed = InputBox(Prompt) 'Listed is the text from the input box
lstBox.Items.Add(Listed).ToString() 'lstBox is ListBox1
End Sub
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
With lstBox
.SelectedItem.Remove(Listed)
End With
End Sub
End Class