I have a listview but I would like to add 3 properties (for example one of them is “image”) to the listviewitems in it.
I was fine with making a custom class with the 3 properties and just inheriting ListViewItem but now I need to use MultiSelect, so it means doing things like(in For Each loops):
ListView1.SelectedItems.Item(i).Image
don’t work because it returns a ListViewItem not my CustomClass.
I could always do :
Ctype(ListView1.selectedItems(i), MyCustomClass).Image
But using that over and over again seems like a waste/wrong way to do it?
That is simply how it works. ListView can store any kind of ListItem and to get to the properties of your derived cast, you have to cast it. You are doing it correctly.