Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i get the Column Index and the Row Index when I click on the ListView? 1

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
411
0
16
IT
How can i get the Column Index and the Row Index when I click on the ListView?

peraphs just post but not found, sorry
 
Here's an illustration of one method (in a MouseMove event):

Code:
[COLOR=blue]Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim lp As Integer
     Do Until ListView1.ColumnHeaders(lp + 1).Left > X Or lp + 1 = ListView1.ColumnHeaders.Count
        lp = lp + 1
    Loop
    Debug.Print "Col: " & lp
    lp = 0
    Do Until ListView1.ListItems(lp + 1).Top > Y Or lp + 1 = ListView1.ListItems.Count
        lp = lp + 1
    Loop
    Debug.Print "Row: " & lp
   
   [COLOR=green]' Following would also return row, but not column
   ' as, unlike the .NET listview, there is no SubItem index
   ' Debug.Print ListView1.HitTest(X, Y).Index[/color]
End Sub[/color]
 
Strongm
As usual la you are a gentleman!
Tks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top