title: Reading and writing registry returns error
body: <p>Well, I'm trying to write/read a SubKey on my application, but it give me a error.</p>
  
  <pre><code>Registry.LocalMachine.OpenSubKey("Software\\SAMP", true).SetValue("PlayerName", textBox1.Text);
  string gamePath = Registry.LocalMachine.OpenSubKey("Software\\SAMP").GetValue("gta_sa_exe").ToString();
  </code></pre>
  
  <p>The error is on the first line:</p>
  
  <p>"Object reference not set to an instance of an object."</p>
  
  <p>Sorry, but I am pretty newbie on C# and just can't figure it out.</p>