We help IT Professionals succeed at work.

Copy data cell content of a listview

santosh_14 asked
Medium Priority
Last Modified: 2006-11-17
I've got a listview in Report view fashion with gridlines.

I want to copy the contents of a datacell highlighted with CTRL+C

Why does it not work?

How to make it work.
BTW ... I do not want to enable editing of the listview

Watch Question

A listview control is not meant to handle data the same way a data grid does. A data grid control is broken down into individual cells, but a listview control is really just a key item with associated data. There really is no way to select an individual "cell" from a listview. You can capture the key item from a listview with a ctrl-c:

Private Sub ListView1_KeyUp(KeyCode As Integer, Shift As Integer)
    Dim s As String
    If Chr(KeyCode) = "C" And Shift = 2 Then
        s = ListView1.SelectedItem.Text & " " & ListView1.SelectedItem.SubItems(1) & " " & ListView1.SelectedItem.SubItems(2)
        MsgBox s
    End If
End Sub

Explore More ContentExplore courses, solutions, and other research materials related to this topic.