30-Day Trial Feature
Posted: Wed Aug 19, 2009 8:25 pm
Hello,
Ive got a trial feature for you should anyone need it for your application. It works by using the "Date" and heres how it works:
![Image]()
When someone runs your application for the first time it will grab the current date and add '30' days to it and then store this date. The user can run your application as much as they want for 30 days. If they run the application after 30+ days then it will ask for an activation key, if they dont enter a key or if the key is wrong then the application will not start untill the correct key is entered. They can also activate the program before the end of the 30 day trial.
You can select how many days the trial should run for and the activation key required.
This is how to make it:
Start a new project
Place a button on the form (this will be the activation button)
Go into Project > Project Properties
Now enter the following 2 settings in the 'Settings' tab
apptrial - with a value of "1"
trialcode - leave this value blank
Then add this code to your project:
. Compile and run!
It would be very easy to integrate this code to any of your current or future applications as it only uses one button and the code is very short ;) .
Source-Code:
Thank you and happy coding.
Ive got a trial feature for you should anyone need it for your application. It works by using the "Date" and heres how it works:

When someone runs your application for the first time it will grab the current date and add '30' days to it and then store this date. The user can run your application as much as they want for 30 days. If they run the application after 30+ days then it will ask for an activation key, if they dont enter a key or if the key is wrong then the application will not start untill the correct key is entered. They can also activate the program before the end of the 30 day trial.
You can select how many days the trial should run for and the activation key required.
This is how to make it:
Start a new project
Place a button on the form (this will be the activation button)
Go into Project > Project Properties
Now enter the following 2 settings in the 'Settings' tab
apptrial - with a value of "1"
trialcode - leave this value blank
Then add this code to your project:
Code: Select all
Change the code "ABCD123" to whatever you want the activation key to be and if you want to change how many days the trial should run, just change this piece of code with the number of days:Public Class Form1
'THIS ALLOWS ACTIVATION BEFORE 30 DAY TRIAL IS UP
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim trialkey = InputBox("Please enter your activation key:", "Activation")
If trialkey = "ABCD123" Then
My.Settings.trialcode = "ABCD123"
My.Settings.Save()
End If
End Sub
'THIS CHECKS IF THE PROGRAM IS ACTIVATED OR STILL IN TRIAL WHEN RUN
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tcode = Convert.ToString(My.Settings.trialcode)
If (tcode = "ABCD123") Then
Button1.Visible = False
Else
isittrial()
End If
End Sub
'THIS CHECKS IF ITS FIRST TIME BEING USED AND IF THE 30 DAY TRIAL HAS EXPIRED
Private Sub isittrial()
Dim trialtime As Date = Now
Dim currentdatetime As Date = Now
trialtime = trialtime.AddDays(30) 'SET THIS TO HOWEVER MANY DAYS YOU WANT THE TRIAL TO RUN FOR
Dim ttime = Convert.ToString(My.Settings.apptrial)
If (ttime = "1") Then
My.Settings.trialcode = trialtime
My.Settings.apptrial = "0"
My.Settings.Save()
End If
If (currentdatetime > trialtime) Then
Dim trialkey = InputBox("Your trial as expired. Please enter your activation key:", "Activation")
If trialkey = "ABCD123" Then
My.Settings.trialcode = "ABCD123"
My.Settings.Save()
Else
Me.Close()
End If
End If
End Sub
End Class
Code: Select all
And thats it trialtime = trialtime.AddDays(30)

It would be very easy to integrate this code to any of your current or future applications as it only uses one button and the code is very short ;) .
Source-Code:
Thank you and happy coding.