title: Change a registry value in VB.NET
body: <p>I have searched a lot to find a solution for my problem, but I can't find any specific solution.</p>
  
  <p>I need to change a value which is stored under <code>HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME</code>. It is not possible to use .NET's registry functions, since they have drastic restrictions.</p>
  
  <p>The following snippet should solve my problem:</p>
  
  <pre><code>Dim regKey As RegistryKey
  Dim ver As Decimal
  regKey = My.Computer.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME", True)
  </code></pre>
  
  <p>regKey.SetValue("IP", "192.168.10.15:18500")
     regKey.Close()</p>
  
  <p>Unfortunately, I get a NullReferenceExeption when I try to set the value.</p>
  
  <p>What should I do? I have imported Microsoft.Win32 and RegistryKey doesn't accept any constructor.</p>