I am trying to populate a 2-column ListView using the registry key and data. I am able to "build" the listview and save to the registry. The first column of the list view is the registry subkey and the second column is the data.
This project sat idle for over 13 years and I am basically self-taught. Things have changed.
List View owner draw is true.
rootB is Public const = "HKCU\software\my sorter."
Registry is read from at this time.
There are currently 2 keys (profiles) where each key has 2 subkeys with assigned values (test mode).
The profile argument is the last saved profile.
There are stray comments that have not been removed - my apologies.
Program has issues at the line "GetSubKeyNames()".
Nested parenthesis is nothing new to me and I will be able to do so if given the chance.Code:Private Sub GetREG(ByRef profile As String) 'If Registry.GetValue(rootB + "\" + profile, "", Nothing) <> Nothing Then 'clear the ListView box ListView1.Items.Clear() 'rebuild the ListView box MessageBox.Show("Profile in argument: " + profile) '===OK. Dim RegKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\My Sorter\" + profile) For Each Subkey As String In RegKey.GetSubKeyNames() 'For Each Subkey In Subkeys Dim tempkey As RegistryKey = RegKey.OpenSubKey(Subkey) MessageBox.Show("subkey name: ", Subkey) 'ListView1.Items.Add(Subkey, Registry.GetValue(rootB + "\" + profile, Subkey, "")) Dim listItem As New ListViewItem(tempkey.ToString) listItem.SubItems.Add(Registry.GetValue(rootB + "\" + profile, tempkey.ToString, "")) ListView1.Items.Add(listItem) Next RegKey.Close() 'Else 'MessageBox.Show("No GetValue: " + profile) 'End If End Sub




Reply With Quote
