get registy value

G

Guest

hello,
i'm having a bit of trouble reading a default value from the registry, and
i'm wondering if anyone else has run into this. this is the code i use

Dim key As Microsoft.Win32.RegistryKey
key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Clients\Mail")
Dim name As String = CType(key.GetValue("(Default)"), String)
MessageBox.Show(name)

this returns a blank string but when i view the view with regedit the
(Default) key has a value (the value is currently Outlook Express. i thought
it might me a problem with the key being with () but if i add a key (testkey)
and assign it a value, then modify my code to key.GetValue("(testkey)"), the
value of the test key shows up .
has anyone else seen this of am i querying the registy incorrectly?
 
G

Guest

Hi Gabe,

use this sentence:
Dim name As String = CType(key.GetValue(name, "DEFAULT-VALUE"),
String)

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
 
G

Guest

that worked perfectly.
thank-you

Jorge Serrano said:
Hi Gabe,

use this sentence:
Dim name As String = CType(key.GetValue(name, "DEFAULT-VALUE"),
String)

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top