|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
create registry value - bug in VS?The following code should work and doesn't: My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") My.Computer.Registry.LocalMachine.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", "loglevel", "1") My.Computer.Registry.LocalMachine.GetValue("loglevel") This code does work: My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", "loglevel", "1") My.Computer.Registry.LocalMachine.GetValue("loglevel") 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 Show quoteHide quote "Ben" <ben553***@yahoo.com> wrote in message news:uD3px7ogGHA.5088@TK2MSFTNGP02.phx.gbl... >I am having a problem creating a registry key. I am using the following > code: > > My.Computer.Registry.LocalMachine.CreateSubKey("Software\programalpha") > My.Computer.Registry.LocalMachine.SetValue("loglevel", "7") > My.Computer.Registry.LocalMachine.GetValue("loglevel") > > 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 > > 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" <ben553***@yahoo.com> a écrit dans le message de news: %23fjXGbygGHA.3***@TK2MSFTNGP03.phx.gbl...Show quoteHide quote >I think I might have found a bug in Visual Studio. > > The following code should work and doesn't: > My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") > My.Computer.Registry.LocalMachine.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", > "loglevel", "1") > My.Computer.Registry.LocalMachine.GetValue("loglevel") > > This code does work: > My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") > My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", > "loglevel", "1") > My.Computer.Registry.LocalMachine.GetValue("loglevel") > > 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" <ben553***@yahoo.com> wrote in message > news:uD3px7ogGHA.5088@TK2MSFTNGP02.phx.gbl... >>I am having a problem creating a registry key. I am using the following >> code: >> >> My.Computer.Registry.LocalMachine.CreateSubKey("Software\programalpha") >> My.Computer.Registry.LocalMachine.SetValue("loglevel", "7") >> My.Computer.Registry.LocalMachine.GetValue("loglevel") >> >> 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 >> >> > > Looks like the My NameSpace uses the same strategy i.e. keys are to be
opened/closed. Try : With My.Computer.Registry.CurrentUser.CreateSubKey("Software\Dravet") ..SetValue("loglevel", 1) ..Close() End With (I'm using CurrentUser as I'm not working under an administrative account ) -- Patrice "Patrice" <scr***@chez.com> a écrit dans le message de news: O%234LejygGHA.1***@TK2MSFTNGP03.phx.gbl...Show quoteHide quote > 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" <ben553***@yahoo.com> a écrit dans le message de news: > %23fjXGbygGHA.3***@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("Software\Dravet") >> My.Computer.Registry.LocalMachine.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", >> "loglevel", "1") >> My.Computer.Registry.LocalMachine.GetValue("loglevel") >> >> This code does work: >> My.Computer.Registry.LocalMachine.CreateSubKey("Software\Dravet") >> My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\Software\Dravet", >> "loglevel", "1") >> My.Computer.Registry.LocalMachine.GetValue("loglevel") >> >> 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" <ben553***@yahoo.com> wrote in message >> news:uD3px7ogGHA.5088@TK2MSFTNGP02.phx.gbl... >>>I am having a problem creating a registry key. I am using the following >>> code: >>> >>> My.Computer.Registry.LocalMachine.CreateSubKey("Software\programalpha") >>> My.Computer.Registry.LocalMachine.SetValue("loglevel", "7") >>> My.Computer.Registry.LocalMachine.GetValue("loglevel") >>> >>> 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 >>> >>> >> >> > >
Check if an object is treatable as string/char
A (not so) basic question. select case Type CLS-Compliance and Array Parameter Rank Data in datagridview from a text file ADO.NET and Currency Manager/Binding Context (Newbie question) create registry key Can you embed a SQL database? Result of a query into a variable in VB.NET Help connecting to northwind database |
|||||||||||||||||||||||