Hello guys, I have made an application in which I want to make my application expired after 6 months. and then user enters a key to activate and then application again validates for another 6 months.
My code is:
Public Class Form8
Dim date1 As Date = #7/24/2012 9:00:00 PM#
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Now As DateTime = DateTime.Now
Dim result As Integer = DateTime.Compare(Now, date1)
If result <= 0 Then
LoginForm1.Show()
Me.Close()
Else
MessageBox.Show("This Tool has been Expired, Please enter valid Key to continue.", "Expired...",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If TextBox1.Text = "asdfghjkl" Then
date1 = #1/24/2013 10:00:00 PM#
MessageBox.Show("Congratulations...!! Your Product has been validated for next 6 months", "Activated...",
MessageBoxButtons.OK, MessageBoxIcon.Information)
Form8_Load(sender, e)
Else
MessageBox.Show("Invalid Key", "Expired...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
End Class
Everything is working fine but the problem is after 6 mnths when the current time is greater then the mentioned time and when user enters the key, user have to enter the key for every use.
Please tell me how can i set date1 so that it can be set for every use.