title: Writing to registry in a C# application
body: <p>I'm trying to write to the registry using my C# app.</p>
  
  <p>I'm using the answer given here: <a href="https://stackoverflow.com/questions/1660870/writing-values-to-the-registry-with-c#answer-1660938">Writing values to the registry with C#</a></p>
  
  <p>However for some reason the key isn't added to the registry.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>string Timestamp = DateTime.Now.ToString("dd-MM-yyyy");
  
  string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\"+Application.ProductName+"\\"+Application.ProductVersion;
  string valueName = "Trial Period";
  
  Microsoft.Win32.Registry.SetValue(key, valueName, Timestamp, Microsoft.Win32.RegistryValueKind.String);
  </code></pre>
  
  <p>The <code>Application.name</code> and <code>Application.version</code> 'folders' don't exists yet.</p>
  
  <p>Do I have to create them first?</p>
  
  <p>Also, I'm testing it on a 64b Win version so I think if I want to check the registry for the key added I have to specifically check the 32bit registry in: C:\Windows\SysWOW64\regedit.exe don't I?</p>