Here's the code to update the registry:
string strPath = "Software\\Path\\To\\Registry\\Location";
RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(strPath, true);
regKeyAppRoot.SetValue("Key1", "Value1");
regKeyAppRoot.SetValue("Key2", "Value2");
regKeyAppRoot.Close();
If the key doesn't exist, then you will get a null exception error: "System.NullReferenceException: Object reference not set to an instance of an object." This just means that you have to create the key before you can update it.
RegistryKey rk = Registry.CurrentUser.CreateSubKey(strPath);
rk.Close();
Initially, I thought it was a permission issue with updating the registry. So I added owner permissions to pretty much anyone and everyone. But I still got the issue. Finally figured out that all I had to do was create the Subkey. Hopefully I just saved someone hours of work.