hi all

how to make a trial version of application with progress bar showing 10 days left in vb.net

What have you done sofar? Any code? Also how many days is the trial version working for? What do you want to display for the days before the ten days?

Edited 1 Year Ago by Minimalist

no i tried but didnt work ... i want something like 10 days trial period and when trial expire after 10 days the registration prompt appear

So show us the code that doesn't work for you. Tell us what you have tried, we are not mind readres. Also read the "Read Me" at the beginning of vb.net

This isn't a hard thing to do, firstly you need to know how are you gonna determine the expire date then suppose on the last ten days lest you want to place the value of progress bar to Value 10 so as for each new day you minus a certain value from the progress bar value if you were working or counting with 10 from the beginning then you can then still minus 10 for each new day to 0 then as soon as the count reach 0 perform your expiration activities.

But from my understanding it won't be the value 10 if your app is a 30 days trial, you need to calculate that because the progressbar is 100 so you need to get a number that can fit with 30 then it will be much easier to minus that number for each new day.

Show us what you have done and we can help you in your problem

Make a subprocedure which must run at when the application starts and check the date difference. The date must store in a file, like .xml or database or you can also use registry value.

This is not a safe way, but it works

    Private Sub InstalledFinished()
        IO.File.WriteAllText("C:\Path\Path..\ProgramInstalledDate.txt", Now)
    End Sub

    Private Sub CheckTrailPeriod()
        Dim DateAndTime As Date = IO.File.ReadAllText("C:\Path\Path..\ProgramInstalledDate.txt")
        Dim DaysInstalled = DateDiff(DateInterval.Day, DateAndTime, Now)
        If DaysInstalled > 10 Then
            MsgBox("Your trail is over")
            Me.Close()
        Else : ProgressBar1.Value = 10 - DaysInstalled
        End If
    End Sub

If someone finds the file path they can simply remove it and start the trail over again. There are much more complicated ways to prevent this abuse, but like I stated, they are complicated. You can have the program register online or do some ninja like stuff in the registry or file path (obfuscate the date and time, encrypt it, etcetera).

Best of luck!

Edited 1 Year Ago by §AE§

This article has been dead for over six months. Start a new discussion instead.