Search code examples
databasevb.netlistviewhighlight

Retrieving data from ListView control in VB.NET


I have a ListView setup in details mode that looks like this:

alt text

When the user presses the delete button, I need to go ahead and delete their record from the database. This I can do fine, but I'm stuck on how I retrieve the data that is highlighted in the ListView control. I've tried using Google but all the examples I found have failed to work.

Can someone help me out here?


Solution

  • You should be able to get the underlying object by using:

    ListView1.SelectedItems(0)
    

    Once you remove it from the database you should rebind the data.