473,672 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.LocalMach ine.SetValue("H KEY_LOCAL_MACHI NE\Software\Dra vet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

This code does work:
My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.SetValue( "HKEY_LOCAL_MAC HINE\Software\D ravet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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*******@yaho o.com> wrote in message
news:uD******** ******@TK2MSFTN GP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\pro gramalpha")
My.Computer.Reg istry.LocalMach ine.SetValue("l oglevel", "7")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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 5571
And the error is ?

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

--
Patrice

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

The following code should work and doesn't:
My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.LocalMach ine.SetValue("H KEY_LOCAL_MACHI NE\Software\Dra vet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

This code does work:
My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.SetValue( "HKEY_LOCAL_MAC HINE\Software\D ravet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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*******@yaho o.com> wrote in message
news:uD******** ******@TK2MSFTN GP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\pro gramalpha")
My.Computer.Reg istry.LocalMach ine.SetValue("l oglevel", "7")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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.Reg istry.CurrentUs er.CreateSubKey ("Software\Drav et")

..SetValue("log level", 1)

..Close()

End With

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

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

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

--
Patrice

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

The following code should work and doesn't:
My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.LocalMach ine.SetValue("H KEY_LOCAL_MACHI NE\Software\Dra vet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

This code does work:
My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\Dra vet")
My.Computer.Reg istry.SetValue( "HKEY_LOCAL_MAC HINE\Software\D ravet",
"loglevel", "1")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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*******@yaho o.com> wrote in message
news:uD******** ******@TK2MSFTN GP02.phx.gbl...
I am having a problem creating a registry key. I am using the following
code:

My.Computer.Reg istry.LocalMach ine.CreateSubKe y("Software\pro gramalpha")
My.Computer.Reg istry.LocalMach ine.SetValue("l oglevel", "7")
My.Computer.Reg istry.LocalMach ine.GetValue("l oglevel")

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
8854
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
1
2574
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" /> <add key="userID" value="registry:HKLM\Software\Foo,userID" /> <add key="initialCatalog" value="registry:HKLM\Software\Foo,initialCatalog" /> <add key="dataSource" value="registry:HKLM\Software\Foo,dataSource" /> <add key="integratedSecurity"
6
16805
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 String, ByVal FILE_EXTENTION_DESCRIPTION As String, ByVal EXE_NAME As String, ByVal DEFAULT_OPEN_COMMAND As String, ByVal DEFAULT_ICON As String, ByVal ACTION_NAME As String) Dim RegKey As RegistryKey RegKey = Registry.ClassesRoot.CreateSubKey
17
3299
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 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. I think I need to create a dll that returns error messages for event ID’s.
4
1474
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 the direction of how to create a Short Cut and place it in the folder "C:\Documents and Settings\'User Name'\Start Menu\" or am I better off setting/unsetting a registry entry somewhere? (noting that most Users will not have Administrator...
2
3163
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") 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...
0
1719
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 Photo. Any suggestions on how to solve this? i can't do much at the moment. Server Error in '/PhotoGallery' Application. -------------------------------------------------------------------------------- Cannot create/shadow copy 'Photo' when...
1
8917
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 Photo. Any suggestions on how to solve this? i can't do much at the moment. Server Error in '/PhotoGallery' Application. -------------------------------------------------------------------------------- Cannot create/shadow copy 'Photo' when...
4
1716
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: Imports System.IO Imports System.Text Imports System.Security.Cryptography Imports System.Net Imports Microsoft.VisualBasic.Conversion Imports System.Management
0
8486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.