Hi there. May I know how do I get the icon of a program to display along with the name of it?
Thank you!
EDIT: I know this has been asked a billion time. But when I tried to get the codes together, I get many warnings and exception errors. So yeah, I guess here's the place. Once again, thank you!
VB.NET:
Public Partial Class MainForm
Public Sub New()
' The Me.InitializeComponent call is required for Windows Forms designer support.
Me.InitializeComponent()
Try
Dim rk As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
Dim sk As String
Dim appKey As RegistryKey
Dim displayNameValue As Object
Dim displayName As String
If Not (rk Is Nothing) Then
For Each sk In rk.GetSubKeyNames
appKey = rk.OpenSubKey(sk)
displayNameValue = appKey.GetValue("DisplayName")
If Not (displayNameValue Is Nothing) Then
listView1.Items.Add(CType(displayNameValue, String))
End If
Next
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Error Accessing Registry")
End Try
'
' TODO : Add constructor code after InitializeComponents
'
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView1.View = View.Details
ListView1.Width = 400
ListView1.Columns.Add("Name", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Icon", 37, HorizontalAlignment.Left)
ListView1.AllowColumnReorder = True
ListView1.Columns(0).DisplayIndex = 1
End Sub
End Class
Thank you!
EDIT: I know this has been asked a billion time. But when I tried to get the codes together, I get many warnings and exception errors. So yeah, I guess here's the place. Once again, thank you!
Last edited: