473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

create registry value - bug in VS?

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
2 5557
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
1
by: Adnan Selimovic | last post by:
Hi folks! I have Framework 1.0 installed and I would like to point to registry from my Web.config file: <connectionString> <add key="password" value="registry:HKLM\Software\Foo,password" />...
6
by: CMG | last post by:
I am writing a little code to associate an extention with my program. And as far as i can see, i need to do the following: Public Function associatefile(ByVal FILE_EXTENTION_TO_ASSOCIATE As...
17
by: Chris Podmore | last post by:
When I perform: EventLog.WriteEntry(strSource, strEntry, EventLogEntryType.Error, intEventID) The event viewer reports The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile )...
4
by: Doug Bell | last post by:
Hi, I have a small application with a User Settings form I would like to give the Users the ability to (at any time) set the Application to load when the PC is started. Can someone point me in...
2
by: Ben | last post by:
I am having a problem creating a registry key. I am using the following code: My.Computer.Registry.LocalMachine.CreateSubKey("Software\programalpha")...
0
by: Patrick F | last post by:
I keep getting this error message and i don't know whats the problem is and how to solve it. I have a webproject with 2 components (dll) added to it. One is called PhotoGallery and one is called...
1
by: Patrick F | last post by:
I keep getting this error message and i don't know whats the problem is and how to solve it. I have a webproject with 2 components (dll) added to it. One is called PhotoGallery and one is called...
4
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Here is my problem. I have a program that will create a registry key, however it is not and here is the code and also the error that follows: ...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.