Licence Key - Registry Settings

pulsedav

New member
Joined
Jun 12, 2005
Messages
3
Programming Experience
Beginner
Hi,
I have created a vb.net application, which requires a licence key to be entered in order to activate all the features. How do you read/write to the registry, so that each time the application is run, you don't need to keep entering the licence key.

Thanks,
 
When the user enters their key check to see if it's good and if so do this:

VB.NET:
Dim reg As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\ProgramNameHere")

reg.SetValue("licensekey", txtLicense.Text)

On program startup, do this and then check to make sure the code from the registry is valid:

VB.NET:
Dim reg As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\ProgramNameHere")
Dim license As String
license = reg.GetValue("licensekey")

Tip: You may want to encode/encrypt the key before putting it into the registry and don't necessarily name the key "licensekey". That way nobody will know where the key is saved unless they use a registry monitor. Basically, don't make it TOO easy.
 
Back
Top