Writing and reading to/from a registry key in .Net is really easy. All that is implemented in Microsoft.Win32 namespace, so at the start put this in the usings
using Microsoft.Win32;
Than in some function write this
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true) .CreateSubKey("CodeItWell.com");
So, we are creating an object from the RegistryKey class, the object will open the sub key Software in HKEY_CURRENT_USER, and it will create a key there with the name CodeItWell.com.
Now lets create some values in that key
key.SetValue("URL", "http://www.codeitwell.com"); key.SetValue("Number", 1234, RegistryValueKind.DWord);
Here we create a string value URL with data http://www.codeitwell.com, and a DWORD value with its value 1234.
You can set many value kinds... see the picture below

Now open the registry editor Start -> Run -> Write "regedit" -> OK. Go to this path HKEY_CURRENT_USER\Software\CodeItWell.com, you will see the values on the right panel

To read the registry values we will use the same object, see this
MessageBox.Show(key.GetValue("URL").ToString(), "URL");
You will get a message box showing the data in URL value. Try to change that data manually in the registry editor, and then call the event where the above line of code is entered and you will see the data will be changed.








{ 4 comments… read them below or add one }
You saved my alot of time thank you so much for sharing your experience.
I have been using reg cleaners for a long time, and it's good as well.
This is a post about this subject I really wanted to read.