Solved

Get ListView subitem row and column when clicked

Posted on 2010-11-10
2
704 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
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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