how to select Subitem in Listview

Posted on 2004-11-22
Last Modified: 2012-06-27
Is it possible to highlight only the subitem selected when clicked in a listview and return its value. How?
Question by:rdwillett
    LVL 12

    Expert Comment

    'Let's say that your ListView has 4 columns and two rows of data
     'and you select the second record by clicking on it. After that
     'you want to pull out the value from one of the selected columns/rows.
     'Columns:   First   Last     Country     Age
     '                 -----   -----    ---------     ----
     'Row1:       John   Smith   Australia   31
     'Row2:       David  Brown  USA         19
     'show the value from each column for the selected item
     With ListView1.SelectedItem
       Debug.Print .Text                 '1st column value - David
       Debug.Print .SubItems(1)      '2nd column value - Brown
       Debug.Print .SubItems(2)      '3rd column value - USA
       Debug.Print .SubItems(3)      '4th column value - 19
     End With
    LVL 14

    Accepted Solution

    hi jkaios

    try this

    >>Detecting ListView SubItem Clicks in Normal And FullRowSelect Mode

    LVL 14

    Expert Comment

    by:Shiju Sasidharan
    hi rdwillett
     i am gald to know that i was helpful

    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

    Suggested Solutions

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    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…

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now