Windows Develop Bookmark and Share   
 index > Windows Forms General > Registry Application
 

Registry Application

I need to create a simple application that would create a new registry key and a new value. That is all this application is going to do. Can anyone point me in the right direction?
MigrationUser 1  Wednesday, February 26, 2003 8:28 AM
Use the Microsoft.Win32 namespace, taking advantage of the Registry class and its friends.

For example, you might add this Imports statement:


Imports Microsoft.Win32

and then write code like this:

Dim key As RegistryKey = _
 Registry.CurrentUser.OpenSubKey("Software\Lake\LakeControl", True)
Dim subKey As RegistryKey = key.CreateSubKey("NewItem")
subKey.SetValue("NewName", "NewValue")

to create a new key, and a new subkey. Note that keys aren't writable unless you pass True as the second parameter to the OpenSubKey method, and that you'll need to have permissions to write to the user's registry to be able to run this code. 
MigrationUser 1  Wednesday, February 26, 2003 12:13 PM
Thanks. I didn't even know that class existed. I figured there was a Registry class, but did not know where to look.

 :) 
MigrationUser 1  Wednesday, February 26, 2003 12:38 PM
There are sometimes very good reasons to use the registry, but I try my best to never use it if at all possible.  Mind if I ask what you'll be writing in the registry and for what ultimate purpose?
MigrationUser 1  Wednesday, February 26, 2003 12:49 PM
Yeah, to patch the attachment issue in Outlook 2000 SP3 and Outlook 2002. End users need the patch to receive some critical files such as Batch Scripts, Shortcuts, and Access Databases.
MigrationUser 1  Wednesday, February 26, 2003 12:56 PM
gotchya, i remember doing that one myself, fun!  :-| 
MigrationUser 1  Wednesday, February 26, 2003 12:58 PM
Yeah. The problem is that I don't want to install the Framework on each computer and I can't figure out how to bundle the .Net Framework in the install package. Do you now how to fix that?

 :} 
MigrationUser 1  Wednesday, February 26, 2003 1:20 PM
No I don't sorry.  I don't really create any installs ever.  I heard it's a little bit of a problem right now unless you buy some third party software where most of them just make it a checkbox for your install.  I believe this will be made easier in future versions of VS.NET.  Sorry I don't know how to help!
MigrationUser 1  Wednesday, February 26, 2003 1:23 PM
I can't even get that. I get an error saying that you can't add it.
MigrationUser 1  Wednesday, February 26, 2003 1:28 PM
I finally got it. You can see how if you <post>843</post>. :) 
MigrationUser 1  Wednesday, February 26, 2003 4:20 PM

You can use google to search for other answers

Custom Search

More Threads

• Form Flashing aint too flash.
• Interaction of Timer / Stopwatches between the Form and Controller classes
• ContextMenuStripe never closing
• remove disconnected devices
• Need Help Urgent
• ToolStrip ItemCliked Event is not raised when clicked if the form is not focused.
• Multimedia Programming : Customized Media Player
• Drawing on top of WebBrowser Control
• controls creating controls - a convention
• memory leak issues this.Invoke(new EventHandler (ReadData));