System.NullReferenceException: 'Object reference not set to an instance of an object.'

  • Thread starter Thread starter Hex Tech Engineer
  • Start date Start date
H

Hex Tech Engineer

Guest
Heres the code halp plz

public static void checkssettings()
{
RegistryKey rk = Registry.LocalMachine;
RegistryKey key = rk.OpenSubKey(@"SOFTWARE\Kosmik\Settings\");
if (key != null)
{

key.SetValue("Theme", "Dark");
theme = (key.GetValue("Theme")).ToString();


}
else
{

//key.SetValue("Theme", null);
key.SetValue("Theme", "Dark");

}
}


Name Value Type
$exception {"Object reference not set to an instance of an object."} System.NullReferenceException

Continue reading...
 
Back
Top