|
-
Oct 4th, 2006, 03:53 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Registry Into Combobox?
Hello, I am currently making a program in Visual Basic Studio 2005 and I wanted to know if it was possible to be able to read the registry and have all the strings in the folder added into a combobox. What I mean is if I can get all of the strings from a folder like HKCU\Software\Microsoft\Internet Explorer\TypedURLs\ and add them into a combobox line by line? If could someone please give an explanation?
Thanks
-
Oct 4th, 2006, 05:13 PM
#2
Re: Registry Into Combobox?
Why not just set the AutoComplete thingy to URLs?
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Oct 4th, 2006, 05:27 PM
#3
Thread Starter
Addicted Member
Re: Registry Into Combobox?
It isn't for that, I was just using an example.
-
Oct 4th, 2006, 05:30 PM
#4
Re: Registry Into Combobox?
VB Code:
Dim regKey As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Internet Explorer\TypedURLs")
Dim valueNames As String() = regKey.GetValueNames()
Dim upperBound As Integer = valueNames.GetUpperBound(0)
Dim values(upperBound) As String
For i As Integer = 0 To upperBound Step 1
values(i) = CStr(regKey.GetValue(valueNames(i)))
Next i
Me.ComboBox1.Items.AddRange(values)
-
Oct 4th, 2006, 05:34 PM
#5
Re: Registry Into Combobox?
Now, that's assuming that all the values ARE strings. If they're not then I think this should work anyway:
VB Code:
Dim regKey As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Internet Explorer\TypedURLs")
Dim valueNames As String() = regKey.GetValueNames()
Dim upperBound As Integer = valueNames.GetUpperBound(0)
Dim values(upperBound) As Object
For i As Integer = 0 To upperBound Step 1
values(i) = regKey.GetValue(valueNames(i))
Next i
Me.ComboBox1.Items.AddRange(values)
I believe that that will simply call the ToString method of each object so if it isn't a string already it will be converted to one. For some types that will not display the actual data, like REG_BINARY, but at least it will not crash.
-
Oct 4th, 2006, 05:39 PM
#6
Thread Starter
Addicted Member
Re: Registry Into Combobox?
Thanks a lot, works great.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|