using vb.net 2005
used the following code to create a listview item
this part worked great but when I tried to delete and item that has been selected in the listview with this code
vb.net states
Error 1 Value of type 'System.Windows.Forms.ListView.SelectedListViewItemCollection' cannot be converted to 'System.Windows.Forms.ListViewItem'.
what is the error telling me? and how can I accomplish my goal of deleting the item that is selected in the listview?
Newbie in search of knowledge
used the following code to create a listview item
Code:
Private Sub btnItalianSub_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnItalianSub.Click
Dim dblPrice As Double = 4.99
CalculateTotals(dblPrice)
Dim lvItem As ListViewItem = lsvScreen.Items.Add("Italian Sub")
lvItem.SubItems.Add(dblPrice)
End Sub
this part worked great but when I tried to delete and item that has been selected in the listview with this code
Code:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
lsvScreen.Items.Remove(lsvScreen.SelectedItems)
End Sub
vb.net states
Error 1 Value of type 'System.Windows.Forms.ListView.SelectedListViewItemCollection' cannot be converted to 'System.Windows.Forms.ListViewItem'.
what is the error telling me? and how can I accomplish my goal of deleting the item that is selected in the listview?
Newbie in search of knowledge