Hello all
I am trying to get values and set values to the Registry .
When I am trying to access a path that not located at the registry I am getting exaption .
But when i am setting that path with Registry.SetValue(keyName, "", 0);
, all works fine and I can get non existing values from it .
Any idea why i can't use my public int GetComponent(string RegKey)
function on nun existing paths ?
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace LP_Misc
{
public class LP_Registery
{
private const string userRoot = "HKEY_CURRENT_USER";
private const string subkey = @"Software\PCBMatrix\LPWizard";
private string keyName ;
public LP_Registery(string folderName)
{
keyName = userRoot + "\\" + subkey + "\\" + folderName;
//Registry.SetValue(keyName, "", 0);
}
public int GetComponent(string RegKey)
{
return (int)Registry.GetValue(keyName, RegKey, 0);
}
public void SetComponent(string RegKey, int RegVal)
{
Registry.SetValue(keyName, RegKey, RegVal, RegistryValueKind.DWord);
}
}
}
And if it possible what should i do that it will be possible .
Thanks .