Hi
There are mny levels to this type of thing. It is VERY difficult to protect code in a way that can prevent unauthorised use. Unless you are willing to pay for expensive 3rd party tools etc then some sort of simple method with only very limited protection will keep the honest users honest.
You could for example, store a value in the registry and interogate that value to check if valid user or not a nd kill the application if invalid. This would need code to do with the checking and for fetching a validation code and updating the registry value.
Something along those lines would cost nothing except a little time to write the code.
There are numerous other simplistic methods and none are paarticularly secure.