Is there code in visual basic 2008 where i can set my program to expire every 30 days ?
You could check into the FirstRun property, and somehow save that, and check it each time to program is run by using DateDiff....
i dont follow...do u have a sample code?
You can write the code to count from the day of first run to 30 days and just use a simple message box to display that the program is out of date and needs update.
This way,you can create another form that will accept some serial numbers to update the program so that it will continue for another 30 days and so on....!!!!
you can also save a record to the registry.
write a date of first run there.
then every time your program starts,
It checks the record you saved in the registry to find out if the 30days trial has finished.
The only problem in this type of licensing is when your client knows where you save that record.
Another way is to use licensing softwares.
But you need to pay for that software.
I dont know if there's free versions.
try Google search.
This is a nice codes i generated myself to solve this problem......!!!
You can study and look at what i did and improve upon it.....@@@
Try to copy and put into a blank form and debug it to see what happens but you need to change the day on your system date to the number indicated as 13....!! for the trial period to execute.....###
Public Class Form1 Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If MsgBox("Are you sure to exit", MsgBoxStyle.YesNo, "Exit") = MsgBoxResult.No Then e.Cancel = True End If End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load fade_in() If Date.Now.Day <> 13 Then MsgBox("Your application is out-of-date and needs update", MsgBoxStyle.Information, "Trial mode") Me.Close() Else Me.Show() End If End Sub 'Fade in Public Sub fade_in() For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Me.Refresh() Threading.Thread.Sleep(100) Next End Sub 'Fade out: Public Sub fade_out() For FadeOut = 90 To 10 Step -10 Me.Opacity = FadeOut / 100 Me.Refresh() Threading.Thread.Sleep(50) Next End Sub End Class
Edited 3 Years Ago by Reverend Jim: reformatted code
i appreciate your help but i need it to stop the user for using the program. I basically want the user to be prompted for a password to launch the application and after 30 days that password stops working and they wont be allowed access
Can you guys help with this? Thanks
This is untested:
'Make a new form, put this code in it, and set it as your startup form 'Also, make a new user setting of the type "date" called Expiration_Date Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If My.Application.Deployment.IsFirstRun Then My.Settings.Expiration_Date = Now.Date My.Settings.Save() End If If DateDiff(DateInterval.Day, Now, My.Settings.Expiration_Date) > 30 Then '30 is the expiration date Dim Response As String = "~" While Response <> "Password here" And Response <> Nothing Response = InputBox("The 30 day trial is up! Please enter a password to continue using this software!", "Trial") End While If Response = Nothing Then End 'A crude, but effective, way of forcing a close End If Me.Hide() Mainform.show() 'If it passes all the tests, start the main program End Sub End Class
This is not tested and may need debugging but:
Here is an example that creates settings then handles them, adjust the code to work for your program and/or handle the dates like
# Public Function DateGood(NumDays As Integer) As Boolean 'The purpose of this module is to allow you to place a time 'limit on the unregistered use of your shareware application. 'This module can not be defeated by rolling back the system clock. 'Simply call the DateGood function when your application is first 'loading, passing it the number of days it can be used without 'registering. ' 'Ex: If DateGood(30)=False Then ' CrippleApplication ' End if 'Register Parameters: ' CRD: Current Run Date ' LRD: Last Run Date ' FRD: First Run Date Dim TmpCRD As Date Dim TmpLRD As Date Dim TmpFRD As Date TmpCRD = Format(Now, "m/d/yy") TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000") TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000") DateGood = False 'If this is the applications first load, write initial settings 'to the register If TmpLRD = "1/1/2000" Then SaveSetting App.EXEName, "Param", "LRD", TmpCRD SaveSetting App.EXEName, "Param", "FRD", TmpCRD End If 'Read LRD and FRD from register TmpLRD = GetSetting(App.EXEName, "Param", "LRD", "1/1/2000") TmpFRD = GetSetting(App.EXEName, "Param", "FRD", "1/1/2000") If TmpFRD > TmpCRD Then 'System clock rolled back DateGood = False ElseIf Now > DateAdd("d", NumDays, TmpFRD) Then 'Expiration expired DateGood = False ElseIf TmpCRD > TmpLRD Then 'Everything OK write New LRD date SaveSetting App.EXEName, "Param", "LRD", TmpCRD DateGood = True ElseIf TmpCRD = Format(TmpLRD, "m/d/yy") Then DateGood = True Else DateGood = False End If End Function 'Usage Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Set timer and test If Not DateGood(30) Then MsgBox("Trial Period Expired!", vbExclamation, "Unregistered application") Me.Hide() 'Hide if not Else Me.Show() 'Show if good End If End Sub
These bits of code are excellent. However, I need need help making it work. I have an exe which was coded in AutoIt.. fully functional, I just need it linked or whatever to this bit of vb code up top so that it only runs for 30 days then becomes useless. any input is greatly appreciated
Any program that uses an expiry date is subject to being overridden by a program such as TimeStopper unless you can embed a call to an external (internet) time service periodically to get the actual date/time.
i need a code vb which i can add to my project, a code that can display greeting message with alart or music at specific time and date i set for the message to display and user or admin of my software will be able to add new date and greeting to the alart message box of when the greet box will display in future, lf any can help pls reply thanks
Edited 3 Years Ago by omiyehan: error
"A first chance exception of type 'System.Deployment.Application.InvalidDeploymentException' occurred in System.Deployment.dll" error occured durin run of code by Xcelled194.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...