How do I delete a row in a ListView. I need to select the row to be deleted and a command button will delete it with a alert message if you want to delete the row. What will be the code for that?
Assuming you already created ListView (ListView1) and a Click event for the button (let's call it button1), by double-clicking on it, the could would go something like this:
So the code would go something like this:
private sub Button1_Click()
if ListView1.SelectedItem is nothing then exit sub
if MsgBox("Do you really want to delete?", "Question", vbYesNo) = vbYes then
ListView1.ListItems.Remove ListView1.SelectedItem.Index
end if
end sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With