Code for store value inside registry in win32 c++
hi friends i need a code store value inside registry.i have a textbox and i have to take the value and store in registry on button click
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Rajeswari nathan97 reputationPosted Sep 29, 2009, 9:25 PM EDT
using System;
using Microsoft.Win32;
class Class1
{
static void Main(string[] args)
{
RegistryKey RegKeyWrite = Registry.CurrentUser;
RegKeyWrite = RegKeyWrite.CreateSubKey("Software\\CSHARP\\WriteRegistryValue");
RegKeyWrite.SetValue("StringValue","TRUE");
RegKeyWrite.SetValue("Number",100);
RegKeyWrite.Close();
RegistryKey RegKeyRead = Registry.CurrentUser;
RegKeyRead = RegKeyRead.OpenSubKey ("Software\\CSHARP\\WriteRegistryValue");
Object regSuccessful = RegKeyRead.GetValue("StringValue");
Object regAttemptNumber = RegKeyRead.GetValue("Number");
RegKeyRead.Close();
if ((string)regSuccessful == "TRUE")
Console.WriteLine("Succeeded on attempt # {0}",regAttemptNumber);
else
Console.WriteLine("Failed!");
}
}