G
Guest
I have a list view that I would like to change the data of a cell by
celecting the cell.
This is what I have, but it always return me column 0
Public Function GetRowColumn(ByVal Item As MSComctlLib.ListItem) As String
Dim ColH As ColumnHeader
Dim Index As Long
For Each ColH In ListView2.ColumnHeaders
If Col > (ColH.Left + ListView2.Left) And Col < (ColH.Left +
ListView2.Left + ColH.Width) Then
'Found the column
Index = ColH.Index
Exit For
End If
Next
GetRowColumn = "Row:" & Item.Index & " Column:" & Index
End Function
Private Sub ListView2_ItemClick(ByVal Item As Object)
MsgBox (GetRowColumn(Item))
End Sub
Private Sub ListView2_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As Long, ByVal y As Long)
Col = x
End Sub
Thanks a lot, Lina
celecting the cell.
This is what I have, but it always return me column 0
Public Function GetRowColumn(ByVal Item As MSComctlLib.ListItem) As String
Dim ColH As ColumnHeader
Dim Index As Long
For Each ColH In ListView2.ColumnHeaders
If Col > (ColH.Left + ListView2.Left) And Col < (ColH.Left +
ListView2.Left + ColH.Width) Then
'Found the column
Index = ColH.Index
Exit For
End If
Next
GetRowColumn = "Row:" & Item.Index & " Column:" & Index
End Function
Private Sub ListView2_ItemClick(ByVal Item As Object)
MsgBox (GetRowColumn(Item))
End Sub
Private Sub ListView2_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal x As Long, ByVal y As Long)
Col = x
End Sub
Thanks a lot, Lina