Hi guys,Currently I am updating a listview with data in it via clicking on the selected row and displaying that row data onto textboxes and then updating it. What the data has is ID number follow name and QTY. What I want to add to this function is to update the quantity of a specific ID without clicking on the specific row in listview but by searching the ID, returning its results in the textbox, update it.
Vb.net Listview Subitems
Private Sub ListView1DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClickIf ListView1.Items.Count = 0 ThenMsgBox('No Item In The List')Exit SubEnd Ifslist = ListView1.SelectedItems(0)txtItemName.Text = slist.SubItems(1).TexttxtQty.Text = slist.SubItems(2).TextEnd Sub. Hi guys,Currently I am updating a listview with data in it via clicking on the selected row and displaying that row data onto textboxes and then updating it. What the data has is ID number follow name and QTY. What I want to add to this function is to update the quantity of a specific ID without clicking on the specific row in listview but by searching the ID, returning its results in the textbox, update it.I guess your best choice is to find ID using the ListView1.Items.Find(Key) but that depends on how you are populating the Listview. Or Loop through the listview and search for text inside specific column.How you are populating the listview?
Robin,Are you using VB6 and the Listview control from that? If memory serves me correctly, the listitems and subitems are 0 based collections.
Edit Listview Subitem In Vb6 Shell Download
So if you have 3 columns, they should be indexed 0-2.VB6:Debug.Print ListView1.ListItems(0).SubItem(0).TextDebug.Print ListView1.ListItems(0).SubItem(2).TextIf you are using Visual Basic 2005, then you need to change your code since the new control has an Items collection, not a ListItems collection. Here is code for.Net.VB2005:Debug.Print(ListView1.Items(0).SubItems(0).Text)ListView1.Items(0).SubItems(0).Text = 'foo'Adam BradenVisual Basic Team. Robin,Are you using VB6 and the Listview control from that? If memory serves me correctly, the listitems and subitems are 0 based collections. So if you have 3 columns, they should be indexed 0-2.VB6:Debug.Print ListView1.ListItems(0).SubItem(0).TextDebug.Print ListView1.ListItems(0).SubItem(2).TextIf you are using Visual Basic 2005, then you need to change your code since the new control has an Items collection, not a ListItems collection. Here is code for.Net.VB2005:Debug.Print(ListView1.Items(0).SubItems(0).Text)ListView1.Items(0).SubItems(0).Text = 'foo'Adam BradenVisual Basic Team.