I have a method where I am making a trial period.
When the date has exceded its trialperiod the program will not close.
The code looks like this:
Public Sub DemoRestrict()
If My.Settings.dteStartDate = Nothing Then
My.Settings.dteStartDate = Now
End If
If My.Settings.intTime = Nothing Then
My.Settings.intTime = intTime
End If
If My.Settings.blnEnabled = Nothing Then
My.Settings.blnEnabled = blnEnabled
End If
My.Application.SaveMySettingsOnExit = True
'*******************************************************************************
MsgBox("blnEnabled = " & My.Settings.blnEnabled)
MsgBox("Startdato = " & My.Settings.dteStartDate)
If DateDiff(DateInterval.Day, My.Settings.dteStartDate, Now) > 12 Then
My.Settings.blnEnabled = False
End If
MsgBox("blnEnabled = " & My.Settings.blnEnabled)
If My.Settings.blnEnabled = False Then
MsgBox("The Demo has reached the end of it's trial.")
Me.Close()
End If
My.Settings.dteLastStart = Now
If My.Settings.blnFirstTime = True Then
My.Settings.blnFirstTime = False
End If
'Saves variable settings
My.Settings.Save()
My.Settings.lngTimeLeft = 12 - (DateDiff(DateInterval.Day, My.Settings.dteStartDate, Now))
MsgBox("This is a 12 days Trial Demo." & vbCrLf & "You have " & CStr(My.Settings.lngTimeLeft) & " days left.", MsgBoxStyle.OkOnly, "Demo Trial")
My.Settings.Save()
End Sub
Why does the form not close? is just runs to the next method in the load sequence