I want to read from Registry and set some Values, but i keep getting NullReferenceExceptions.
public partial class Form1 : Form
{
RegistryKey rkApp = null;
RegistryKey settings = null;
public Form1()
{
InitializeComponent();
rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
settings = Registry.CurrentUser.OpenSubKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Shit", true);
if (settings.GetValue("automove") != null)
{
automove = true;
autostartToolStripMenuItem.Checked = true;
}
}
}
i deleted some unrelevant code in this example but this is my code... Any Ideas?
The error appears in line if (settings.GetValue("automove") != null)