Edit Cells in ListView

Add a textbox and name it TextOverlay


 Dim iRow, iCol as Integer


Private Sub TextOverlay_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Hanldes TextOverlay.TextChanged
ListView1.Items(iRow).SubItems(iCol).Text = TextOverlay.Text End Sub Private Sub ListView1_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick Dim hit As ListViewHitTestInfo = ListView1.HitTest(e.X, e.Y) Dim iWidth As Integer For iCol = 0 To hit.Item.SubItems.Count - 1 If hit.Item.SubItems(iCol).Bounds.Left <= e.X Then If iCol = 0 And hit.Item.SubItems.Count > 1 Then If e.X <= hit.Item.SubItems(1).Bounds.Left Then iWidth = hit.Item.SubItems(1).Bounds.Left Exit For End If ElseIf e.X <= hit.Item.SubItems(iCol).Bounds.Right Then iWidth = hit.Item.SubItems(iCol).Bounds.Width Exit For End If End If Next iRow = hit.Item.Index TextOverlay.Left = ListView1.Left + hit.SubItem.Bounds.Left + 3 TextOverlay.Top = ListView1.Top + hit.SubItem.Bounds.Top TextOverlay.Width = iWidth TextOverlay.Height = 18 TextOverlay.Text = hit.SubItem.Text TextOverlay.Visible = True TextOverlay.ReadOnly = False End Sub
'https://stackoverflow.com/questions/10298551/make-a-cell-editable-in-a-listview

Add combobox to listview

Dim Combo As New ComboBox

Dim lvitem As ListViewItem = lstGroups.Items.Add("Add to the right -->")

        Combo.DropDownStyle = ComboBoxStyle.DropDown

        Combo.Height = lvitem.Bounds.Height

        Combo.Location = New Point(lvitem.Bounds.Right - 20, lvitem.Bounds.Y)

        AddHandler Combo.SelectedIndexChanged, AddressOf Combo_SelectedIndexChanged

        AddHandler Combo.KeyUp, AddressOf Combo_KeyUp

        'AddHandler Combo.sel AddressOf Combo_SelectedIndexChanged

        lstGroups.Controls.Add(Combo)


--

Private Sub Combo_SelectedIndexChanged(sender As Object, e As EventArgs)

        'Throw New NotImplementedException()

        Dim cmb As ComboBox = CType(sender, ComboBox)

     If cmb.Text = "Add to the right -->" Then Return

        If MsgBox("Add? " & cmb.Text, MsgBoxStyle.YesNo) = vbYes Then

            Dim lvItem As ListViewItem = lstGroups.Items.Add(cmb.Text)

            AddGroup(sServer, cmb.Text)

    End If

End Sub



Private Sub Combo_KeyUp(sender As Object, e As KeyEventArgs) 'Handles ComboBox1.KeyUp

        If e.KeyCode = Keys.Enter Then

            Combo_SelectedIndexChanged(sender, Nothing)

        End If

End Sub