This is probably easy as well. But I have this listview which contains exe files I've listed up. Now, I want to execute these exe files in turn from which items are checked or not.
So, I've tried this:
For each item in listView1.CheckedItems
Msgbox item.ToString
Next
Cause I noticed that the item in checkedItems doesn't contain much. And if I convert it to a string, it ends up in the msgbox looking like this: ListViewItem: {Filename.exe}
Now, I want the filename obviously. But is there any other way of extracting the name only? Or do I have to strip the string to remove the ListViewItem: {
part away?
Your first step should have been to consult the documentation of ListViewItem
to find out how to retrieve the required information from the object.
The Text
property is what you’re after.
For Each item in listView1.CheckedItems
MsgBox(item.Text)
Next