30-Day Trial Feature

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
15 posts Page 1 of 2
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

30-Day Trial Feature
CodenStuff
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:
Code: Select all
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
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:
Code: Select all
trialtime = trialtime.AddDays(30)
And thats it :D . 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:
TrialActivation.zip

Thank you and happy coding.
You do not have the required permissions to view the files attached to this post.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Re: 30-Day Trial Feature
hungryhounduk
Hi
Cool 8-)
Another good Straight to the point bit of Coding cooll;
Image
User avatar
CodemaN
VIP Access - Denied
VIP Access - Denied
Posts: 74
Joined: Fri Sep 18, 2009 3:18 pm

Re: 30-Day Trial Feature
CodemaN
thankssssssssssssss man!!!!!!!!!!!!!!!!!!!11
User avatar
Doctorfrost
Dedicated Member
Dedicated Member
Posts: 53
Joined: Sun Oct 04, 2009 4:44 am

Re: 30-Day Trial Feature
Doctorfrost
good program, this is great for people offering a trial version of the application.

If i succeed in my program, im sure to use this.
Thanks :)
User avatar
Robby
VIP - Donator
VIP - Donator
Posts: 417
Joined: Mon Aug 03, 2009 4:01 am

Re: 30-Day Trial Feature
Robby
Cool nice application.

But sometimes people can nchange there date back to the date they got their program so i dont know it might not be affective if they change their date back.


I have used this for one of my programs and ty :)


Robby1998
My current Projects Listed Below:
Toixt++ Text Editor Just 10 or less more features to go!
Image
Image
GoodGuy17
Coding God
Coding God
Posts: 1610
Joined: Mon Sep 07, 2009 12:25 am

Re: 30-Day Trial Feature
GoodGuy17
If this works out correctly for me, I'm going to put it in my VOS!
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: 30-Day Trial Feature
Codex
I agree with Dummy1912, maybe have a file online and add "1" everyday its run or something like that ?
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: 30-Day Trial Feature
Dummy1912
i don't like this way
Code: Select all
My.Settings.
because if you are really good with your pc and know a little of it
you can easely find that file and delete it.

so there you have 30 days again :(

Dummy1912
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: 30-Day Trial Feature
Axel
Dummy1912 wrote:
i don't like this way
Code: Select all
My.Settings.
because if you are really good with your pc and know a little of it
you can easely find that file and delete it.

so there you have 30 days again :(

Dummy1912
Solutions :

1)if the application.setting file is missing then the application would shutdown (or return the trail value to 0)
2)write a registry key ( but you can deny it with spybot...)
3)the application settings could also be stored on your application i think
http://vagex.com/?ref=25000
User avatar
Danny
VIP - Donator
VIP - Donator
Posts: 621
Joined: Sat Oct 30, 2010 8:21 pm

Re: 30-Day Trial Feature
Danny
it's great clapper;
15 posts Page 1 of 2
Return to “Tutorials”