Reputation: 153
In the setup i add this registry file like the image below.For security issues i dont want someone to copy the folder of the software and put it on other pc and work this is why added this file.
All i want is in my form 1 (main) on load to check if the registry file exists to be able to continue with the program else terminate. Do i need a for loop?
If you have any better suggestions let me know.
private void Form1_Load(object sender, EventArgs e)
{
RegistryKey MyReg = Registry.CurrentUser.OpenSubKey
("HKLM\\Software\\[Manufacturer]\\checkup");
if (MyReg.ValueCount == 1)
{ }
else{ MessageBox.Show("error");
}
}
do i have to put any value on the checkup?
Any help will be appreciated
Upvotes: 0
Views: 65
Reputation: 11
You forgot to assign the value of the registry to an object. :
object key_value = key.GetValue("Version");
Upvotes: 1