Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Listview and ImageList Question?

$
0
0
I have Open Dialog button which gets the executable files file path. Next is this code for adding in the listview. My question is how can I make the application icon be exact with its corresponding application. My problem is that when I add new exectuable files , the only SmallImage that will be displayed is the newly added one. Next item will lost its SmallImage.
Code:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      If accessFlag = True Then

            Dim imageListSmall As New ImageList()
            Dim ico As Icon = Icon.ExtractAssociatedIcon(path)

            imageListSmall.Images.Add(ico)
            RestrictList.SmallImageList = imageListSmall

            Dim restrictedApp As New ListViewItem(exename, RestrictList.Items.Count)

            With restrictedApp
                .SubItems.Add(path)
            End With
            RestrictList.Items.Add(restrictedApp)
        ElseIf accessFlag = False Then

      End If
End Sub


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>