You may need to start Visual Studio to "Run as Administrator..." by right-clicking on the Visual Studio shortcut. Also make sure the user you're logged in as has write rights to HKLM\Software.
Also consider using Application Settings instead of the registry, if that's even a remote possibility.