[RESOLVED] Custom objects to populate Listview Items collection
Hi
I have created a class by inheriting the ListViewItem and then added some new properties. I then use this inherited class to define objects that I add to my listview. My question is, how do I pick up the new properties when I click on an item.
VB Code:
Class CMyItem
inherits ListViewItem
Public ComponentName as string
Public AccessID as Long
Public Sub New(byval agStrCompName as string, byval agLngAccessID as Long)
ComponentName = agStrCompName
AccessID = agLngAccessID
End Sub
End Class
' In a form I add items to my listview as follows
Dim objItem as CMyItem
objItem = new CMyItem("ComponentA", 16)
ListView1.Add(objItem)
Private Sub ListView1_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles ListView1.Click
' How do I pick up the Componentname property from my custome made item that populates the listview
End Sub
Now I could be using an incorrect approach, I would welcome any alernatives. Just bear in mind that I want to populate my listview with custom made objects that would expose my new properties.
Thanks for your help.
[RESOLVED] Custom objects to populate Listview items collection
Thanks Athley.
It works
:)