I'm trying to show all the hardware listed under the following registry key. HKLM\System\ControlSet\Enum
My code will allow me to open the subkeys and get the names of these keys, but what I really want is to go deeper into the subkeys and get the "Class" "DeviceDesc" and "Mfg" of each of the subkeys. I don't know how to do this. Here is my code.
Private Sub ListView3_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView3.Clear()
ListView3.View = View.Details
ListView3.Columns.Add("Class", 200, HorizontalAlignment.Left)
ListView3.Columns.Add("Description", 400, HorizontalAlignment.Left)
ListView3.Columns.Add("Manfacturer", 200, HorizontalAlignment.Left)
ListView3.Sorting = SortOrder.Ascending
ListView3.FullRowSelect = True
ListView3.GridLines = True
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey _
("System\CurrentControlSet\Enum", False)
Dim SubKeyNames() As String = Key.GetSubKeyNames()
Dim Index As Integer
Dim SubKey As RegistryKey
SubKey = Registry.LocalMachine.OpenSubKey("System\CurrentControlSet\Enum" + "\" _
+ SubKeyNames(Index), False)
For Index = 0 To Key.SubKeyCount - 1
Dim item1 As New ListViewItem(CType(SubKey.GetValue("Class", ""), String))
item1.SubItems.Add((SubKey.GetValue("DeviceDesc", "")))
item1.SubItems.Add((SubKey.GetValue("mfg", "")))
ListView3.Items.AddRange(New ListViewItem() {item1})
Next
Key.Close()
End Sub
My code will allow me to open the subkeys and get the names of these keys, but what I really want is to go deeper into the subkeys and get the "Class" "DeviceDesc" and "Mfg" of each of the subkeys. I don't know how to do this. Here is my code.
Private Sub ListView3_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView3.Clear()
ListView3.View = View.Details
ListView3.Columns.Add("Class", 200, HorizontalAlignment.Left)
ListView3.Columns.Add("Description", 400, HorizontalAlignment.Left)
ListView3.Columns.Add("Manfacturer", 200, HorizontalAlignment.Left)
ListView3.Sorting = SortOrder.Ascending
ListView3.FullRowSelect = True
ListView3.GridLines = True
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey _
("System\CurrentControlSet\Enum", False)
Dim SubKeyNames() As String = Key.GetSubKeyNames()
Dim Index As Integer
Dim SubKey As RegistryKey
SubKey = Registry.LocalMachine.OpenSubKey("System\CurrentControlSet\Enum" + "\" _
+ SubKeyNames(Index), False)
For Index = 0 To Key.SubKeyCount - 1
Dim item1 As New ListViewItem(CType(SubKey.GetValue("Class", ""), String))
item1.SubItems.Add((SubKey.GetValue("DeviceDesc", "")))
item1.SubItems.Add((SubKey.GetValue("mfg", "")))
ListView3.Items.AddRange(New ListViewItem() {item1})
Next
Key.Close()
End Sub
Last edited: