Question : How to update a listbiew subitem via a combo box selection

Hello, I have a listview containing three columns two of which are populated from Listbox selections.  I am trying to populate the third column via a combobox selection.  Howerver, I also want the user to be able to change an existing value in the listview.  I've written the attached code to atempt to do this but I get the following error
"InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index"
1:
2:
3:
4:
5:
6:
Private Sub cboAssignTabId_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboAssignTabId.SelectedIndexChanged
       
        lvMatchedDvid.Items(lvMatchedDvid.Items.Count - 1).SubItems(2).Text = cboAssignTabId.SelectedItem.ToString
        

    End Sub

Answer : How to update a listbiew subitem via a combo box selection

Can you please try changing this:

lvMatchedDvid.Items(lvMatchedDvid.Items.Count - 1).SubItems(2).Text = cboAssignTabId.SelectedItem.ToString

by this:

lvMatchedDvid.Items(lvMatchedDvid.Items.Count - 1).SubItems(0).Text = cboAssignTabId.SelectedItem.ToString

jppinto
Random Solutions  
 
programming4us programming4us