Solved

Get ListView subitem row and column when clicked

Posted on 2010-11-10
2
715 Views
Last Modified: 2012-05-10
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
Comment
Question by:DColin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34101445
Hi,

First clear the rowselection mode to cell.
Second on selectedrow and column you can get the value of that cell.  
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 34101638
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question