Colleagues,
I have a ListBox with the number of items in it, and USer needs need to remove one or two of these items, which he added erroneously. So, (s)he highlights them and clicks "Delete" button.
In the past (and another programming language) it was simple, something like this:
Ain't working in VS 2019 VB .NET, it throws exception:
Neither works the following:
It just don't do anything (albeit neither throws exception).
Please enlighten this "dinosaur" on how nowadays one does deletion of the selected items from a ListBox?
TIA!
Regards,
Ilya
I have a ListBox with the number of items in it, and USer needs need to remove one or two of these items, which he added erroneously. So, (s)he highlights them and clicks "Delete" button.
In the past (and another programming language) it was simple, something like this:
Code:
For I = lstFiles.Items.Count -1 To 0 Step -1
If lstFiles.Items(I).Selected() Then
lstFiles.Items(I).Delete()
End If
'Next
Ain't working in VS 2019 VB .NET, it throws exception:
Neither works the following:
Code:
lstFiles.ClearSelected()
lstFiles.Refresh()
It just don't do anything (albeit neither throws exception).
Please enlighten this "dinosaur" on how nowadays one does deletion of the selected items from a ListBox?
TIA!
Regards,
Ilya