Selecting many list view items with a button

Posted on 2004-10-26
Last Modified: 2013-11-20
I have a list view I would like to be able to select certain items with a button.

The list view contains filenames, and with the click of a button I would like all the files that contain what I'm looking for to be selected and highlighted....

I'm having difficulty with the selection and highlight part of it!

Question by:galneweinhaw
    1 Comment
    LVL 5

    Accepted Solution

    First of all set the ListCtrl style to :"Multi Section".
    The following codes selects Item 0 to 3:

    int i;
          for(i=0; i<4; i++)
          m_MyList.SetItem(i, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED,
          LVIS_SELECTED, 0);

    Good Luck!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    This video Micro Tutorial is the second in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles a…

    910 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

    14 Experts available now in Live!

    Get 1:1 Help Now