• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 731
  • Last Modified:

Get ListView subitem row and column when clicked

Hi Experts,

I am using a Listview control with multiple rows (items) and columns (subitems). I would like to get the row and column of the subitem I have clicked on.
0
DColin
Asked:
DColin
1 Solution
 
Alpesh PatelAssistant ConsultantCommented:
Hi,

First clear the rowselection mode to cell.
Second on selectedrow and column you can get the value of that cell.  
0
 
Wayne Taylor (webtubbs)Commented:
Use the MouseClick event, and get the item clicked with a ListView HitTest....

    Private Sub ListView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
        Dim ht As ListViewHitTestInfo = ListView1.HitTest(e.Location)
        If ht.Location = ListViewHitTestLocations.Label Then
            MsgBox(ht.SubItem.Text)
        End If
    End Sub

Wayne
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now