how can i programaticaly delete the selected item (row) from a listview with 3 or more columns ?
how can i programaticaly delete the selected item (row) from a listview with 3 or more columns ?
Hi.
I make a form with a listview.
I managed to programaticaly add items on the listview but dont know how to edit or remove the selected rows.
Can anyone help me
Thx.
how can i programaticaly delete the selected item (row) from a listview with 3 or more columns ?
George Cai
you can get the Objects of the listbox with SelectedItem (SelectedItems) or listbox.Items array.
http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemwindowsformslistboxclassitemstopic.asp
GoranB
Private
Sub DeleteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteButton.ClickDim
i As Integeri = ListView1.SelectedIndices.Item(0)
ListView1.Items.Item(i).Remove()
End Sub
Its working fine into my app.
Rakesh Kumar V.V. from Pampady
kevin_estcst
I didnt find my answer there. Can u post code
The code must be something like this :
ListView1.ListItems.Remove(ListView1.SelectedItem)
This worked in vb .net 2003
In 2005 doesnt work
micxba
For Each lvi As ListViewItem In Me.ListView1.SelectedItems< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Me.ListView1.Items.Remove(lvi)
Rubal Jain
If anyone can tell how to save the added items on the listview aboce on form closing that will be great.
thx
Morten Dahl
The ListView control's MultiSelect property is set to true by default. If the user selects more than one item, your code will only delete the first one. If you set ListView.MultiSelect = false, then this code is fine.