By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,948 Members | 1,553 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,948 IT Pros & Developers. It's quick & easy.

create registry value - bug in VS?

P: n/a
Ben
I think I might have found a bug in Visual Studio.

The following code should work and doesn't:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.LocalMachine.SetValue("HKEY_L OCAL_MACHINE\Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

This code does work:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\ Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

They are equiviant lines of code, so why doesn't the top code work? From
what I can gather from the MSDN website both pieces of code should work.

Thanks,
Ben

"Ben" <be*******@yahoo.com> wrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\programalpha")
My.Computer.Registry.LocalMachine.SetValue("loglev el", "7")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

When I run the above code the programalpha key is created. The loglevel
value (which can hold the value of numbers between 1 and 10) does not get
created. What am I doing wrong?

Thanks,
Ben

May 29 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
And the error is ?

Also have you tried without the HKEY_LOCAL_MACHINE part as using
LocalMachine likely implies that you are already relative to this location ?

--
Patrice

"Ben" <be*******@yahoo.com> a écrit dans le message de news:
%2****************@TK2MSFTNGP03.phx.gbl...
I think I might have found a bug in Visual Studio.

The following code should work and doesn't:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.LocalMachine.SetValue("HKEY_L OCAL_MACHINE\Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

This code does work:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\ Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

They are equiviant lines of code, so why doesn't the top code work? From
what I can gather from the MSDN website both pieces of code should work.

Thanks,
Ben

"Ben" <be*******@yahoo.com> wrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\programalpha")
My.Computer.Registry.LocalMachine.SetValue("loglev el", "7")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

When I run the above code the programalpha key is created. The loglevel
value (which can hold the value of numbers between 1 and 10) does not get
created. What am I doing wrong?

Thanks,
Ben


May 29 '06 #2

P: n/a
Looks like the My NameSpace uses the same strategy i.e. keys are to be
opened/closed. Try :
With My.Computer.Registry.CurrentUser.CreateSubKey("Sof tware\Dravet")

..SetValue("loglevel", 1)

..Close()

End With

(I'm using CurrentUser as I'm not working under an administrative account )
--
Patrice

"Patrice" <sc****@chez.com> a écrit dans le message de news:
O%****************@TK2MSFTNGP03.phx.gbl...
And the error is ?

Also have you tried without the HKEY_LOCAL_MACHINE part as using
LocalMachine likely implies that you are already relative to this location
?

--
Patrice

"Ben" <be*******@yahoo.com> a écrit dans le message de news:
%2****************@TK2MSFTNGP03.phx.gbl...
I think I might have found a bug in Visual Studio.

The following code should work and doesn't:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.LocalMachine.SetValue("HKEY_L OCAL_MACHINE\Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

This code does work:
My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\Dravet")
My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\ Software\Dravet",
"loglevel", "1")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

They are equiviant lines of code, so why doesn't the top code work? From
what I can gather from the MSDN website both pieces of code should work.

Thanks,
Ben

"Ben" <be*******@yahoo.com> wrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Registry.LocalMachine.CreateSubKey("So ftware\programalpha")
My.Computer.Registry.LocalMachine.SetValue("loglev el", "7")
My.Computer.Registry.LocalMachine.GetValue("loglev el")

When I run the above code the programalpha key is created. The loglevel
value (which can hold the value of numbers between 1 and 10) does not
get
created. What am I doing wrong?

Thanks,
Ben



May 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.