I am trying to display the value of DefaultPassword from HKEY_LOCAL_MACHINE\SOFTWAR
but when ever I try I keep getting "Object reference not set to an instance of an object." If I change the string value I am trying to get information from to Shell within the same key it works fine. Can anyone explain why one works and the other doesn't? I have verified that DefaultPassword is in my registry and I have given it a value or password.
private void Form1_Load(object sender, EventArgs e)
catch (Exception ex)
Key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true);
Val = Key.GetValue("DefaultPassword").ToString();
//Val = Key.GetValue("Shell").ToString();
textBox1.Text = Val;