Put your key in array
Dim key As String(numberOfKeys)
then loop and once you get value put it into ComboBox or any control you present data into
Dim registrykeys(5) As String
'fill your keys
For Each key As String In registrykeys
ComboBox1.Items.Add(My.Computer.Registry.GetValue(key, "property", "default"))
Next
Your array may be 2D to maintain the property of keys
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Put your key in array
Dim key As String(numberOfKeys)
sorry I've mistake in this instead Dim Keys(numberOfKeys) As string
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Give me the keys you want to get and it's properties in that way
Exmaple
Key: HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
Property: ProcessorStringName
Don't worry, just show me you want to learn
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Yes, It could be, understand the C# code, and if you fail to convert any line of code to VB.NET, drop a reply soon.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
C# IS .net. It's just a C style usage of it.
Public Function GetInstalled()
Dim uninstallKey As String
Dim rk As RegistryKey
Dim sk As RegistryKey
Dim skName As String
Dim sublist As New ArrayList
uninstallKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
rk = Registry.LocalMachine.OpenSubKey(uninstallKey, True)
For Each skName In rk.GetSubKeyNames()
sk = rk.OpenSubKey(skName)
sublist.Add(sk.GetValue("DisplayName"))
Next skName
Return sublist
End Function
EDIT: Sorry, Didn't Refresh The Page Before Posting...
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Try Comatose's code, and tell what you get?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Drag a comboBox and drop it into your form
Edit Comatose's code
For Each skName In rk.GetSubKeyNames()
sk = rk.OpenSubKey(skName)
comboBox1.Items.Add(sk.GetValue("DisplayName"))
Next skName
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
You shouldn't modify the function. The concept of a function, is that you shouldn't make them interact with the form. The idea of a function is that a function can be modular.... what if in the future, you decide to change it from a combobox, to a listbox... or save it to a file. Then you have to modify the function that actually GETS the display names of the registry keys. The purpose of a function is abstraction.... what this function does, is get the list of items in the registry (their display values) and returns them to the calling procedure. So for example, if you have a button, you would do:
dim something as new arraylist
something = GetInstalled()
for I = 0 to something.count
msgbox something(i)
next I
It might have to be for I = 0 to something.count -1
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I know Comatose, but it was my last chance to get him solve his problem!!!
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
I know why you did it, and were absolutely right... I just wanted to make the distinction for him, so that he understands the concepts. I would have suggested the same code mod you did ;)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Right, it returns an arraylist. So you would call it from the button, then assign the return value to an arraylist, and loop through it.
dim something as new arraylist
something = GetInstalled()
for I = 0 to something.count
msgbox something(i)
next I
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215