• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 738
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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