Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:45:44+00:00 2026-05-23T04:45:44+00:00

I’ve got this code which basically loops through a set of folders and subfolders

  • 0

I’ve got this code which basically loops through a set of folders and subfolders and finds specific file types. And then lists these in a listview. Now, it’s intended to list exe and msi files. And I’ve made it so that these icons can be doubleclicked after they have been listed. I do this by adding the path to the file in it’s tag property.

But, my superiors want a checkbox next to each item. So that they can check each item they want installed. And then have a button which runs the path in each tag property one at a time. It’s basically the part where I fill the listview with the checkbox, filename of the exe or msi file, tag and the icon that I’m wondering about.

This is the existing code. This includes just a Tile view of the listview.

   Public Sub getDirectories(ByVal strFilepath As String, ByVal strFileExtension As String, ByVal objControl As Object)

        'Load first files from the root folder. Then loop each subfolder
        Dim di As New DirectoryInfo(strFilepath)
        Dim aryFi As IO.FileInfo() = di.GetFiles(strFileExtension, SearchOption.AllDirectories)

        Dim filePath As String
        Dim fileIcon As Icon

        ' For each file in the root folder
        For Each file In aryFi
            If file.Extension = String.Empty Then
            Else
                filePath = GetAssociatedProgram(file.Extension)
                On Error Resume Next

                'Extract icon
                fileIcon = Drawing.Icon.ExtractAssociatedIcon(filePath)
                'Add the icon if we haven't got it already
                objControl.StateImageList = Form1.iconList

                If Form1.iconList.Images.ContainsKey(filePath) Then
                Else
                    Form1.iconList.Images.Add(filePath, fileIcon)
                End If
                'Add item to list
                objControl.items.add(file.Name, filePath).Tag = file.DirectoryName
            End If
        Next

    End Sub

Basically I call this sub in this way:

getDirectories(strProgramLocation, "*.exe", Form1.listViewSupSoftware)

And I’ve found that I can add items to a listview which also contains columns:

        Dim tempstr(2) As String
        tempstr(0) = "Name of item"
        tempstr(1) = "Target folder of item"

        Dim tempNode As ListViewItem
        tempNode = New ListViewItem(tempstr)
        Form1.listViewItem.Items.Add(tempNode)

But there should be a way of combining these two right? I’m not sure how I can add a checkbox in the first column of the listview? I’ve already set the Checkbox property of the listview to True. But I could use some pointers here if anyone’s got any. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:45:45+00:00Added an answer on May 23, 2026 at 4:45 am

    Mmm, I don’t understand quite well your question. If you already have the listbox you just need to use a CheckedListBox and loop thru all the checked items executing the executable stored into the tag property …

    As I said I’m not sure If I get what you mean …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.