Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improved program trial
#1
A little while ago I posted a video tutorial on how to make your application a 30 day trial. Well, after reviewing that video I realized that the code was long obsolete. So here is a new code.

[code2=vbnet]'This variable, trialLength is the number of days you want your free trial (or paid) to last.
Dim trialLength As Integer = 7
If My.Settings.startdate.Year = 1 Then
'Date has not yet been set, set it for today
My.Settings.startdate = My.Computer.Clock.LocalTime
Else
'Date has already been set, check for # days
Dim ts As New TimeSpan(-trialLength, 0, 0, 0, 0)
If My.Settings.startdate.Subtract(My.Computer.Clock.LocalTime) <= ts Then
'This part of the code occurs if the trial is finished
MsgBox("7 Day trial ended!")
Else
'Trial has not yet ended
MsgBox("You're good.")
End If
End If[/code2]

So simply adjust the trialLength variable to how many days you want your trial to last, and put this into your form load sub!
My Blog | My Setup | My Videos | Have a wonderful day.
#2
It's also a good idea to save this in the registry as well.
#3
openeXpressions Wrote:It's also a good idea to save this in the registry as well.

Not really as it can be easily edited using Regedit
#4
AnchoredFTW Wrote:Not really as it can be easily edited using Regedit

This is true; however, alot of people do not know how to use RegEdit.
My Blog | My Setup | My Videos | Have a wonderful day.
#5
Thank You For This. It Will Help Alot!


Possibly Related Threads…
Thread Author Replies Views Last Post
  Making Your Program Start with Windows brandonio21 0 8,904 04-09-2013, 03:10 PM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)