Listview ListSubItems

Posted on 2004-11-26
Last Modified: 2012-05-05

How can I dynamically add listsubitems to a listitem in a listview with events?
I want to be able to detect a right or left click of a particular column of a report style listview.


Question by:bukko
    LVL 48

    Expert Comment

    by:Ryan Chong
    You need to add the listviews' ColumnHeader instead..
    LVL 8

    Author Comment

    I did that.
    I can get click events for the columnheaders with no problems.

    I want a click event for the subitems.
    In other words, I want to be able to click (or event better doubleclick) a row, and be able to determine which column was clicked, not just the row.
    LVL 18

    Assisted Solution

    You can use th emousedown event to get the current Listitem the mouse is over using the listview's 'HitTest' method.

    If there is no horizontal scrolling on the listview then you can get the column the mouse is over by using the 'y' value in the mousedown event and checking this against the column header widths to calculate which column is being clicked.

    The listView isn't designed to have individual cells clicked you may be better off using the FlexGrid control if you want to do that.

    LVL 44

    Accepted Solution

    Have a look here:

    It explains how to detect subitem clicks in full.
    LVL 19

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now