I'm having a little trouble deleting multiple lines for a listbox. I know how to remove a single line, which is this:
Try
If listbox1.Items.Count <> 0 Then
Dim linedel As Integer
linedel = listbox1.Items.IndexOf(listbox1.SelectedItem)
listbox1.Items.RemoveAt(linedel)
Else
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
If I change the value for IndexOf to SelectedItems, I get an error stating that -1 is not valid for index.
I am guessing this needs to be done using an integer array and a for each but I don't know how to do that. I really never bothered to look much into arrays.
Thanks.