Vb.net Check for 30 day trial


/ Published in: VB.NET
Save to your folder(s)

Created by Brandon


Copy this code and paste it in your HTML
  1. Public Class Form1
  2. Public day As String 'Creates all the variables
  3. Public month As String
  4. Public year As String
  5.  
  6. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7. day = My.Computer.Clock.LocalTime.Day 'Declares day,month,and year as the current Day Month and Year
  8. month = My.Computer.Clock.LocalTime.Month
  9. year = My.Computer.Clock.LocalTime.Year
  10. If My.Settings.checked = False Then 'Checks if this is the first time the program has run, if it is, save the current date into a setting.
  11. My.Settings.day = day
  12. My.Settings.month = month
  13. My.Settings.year = year
  14. My.Settings.checked = True
  15. Else
  16. Try
  17. If year = My.Settings.year Then 'If the year is the same, check the month
  18. If month = My.Settings.month Then
  19.  
  20. Else
  21. 'If the month is not the same then check if the day is
  22. If month = My.Settings.month + 1 Then
  23. If day = My.Settings.day Then
  24. msgbox("trial expired!")
  25. Else 'If the day is bigger than the current day, the trial is expired
  26. If day > My.Settings.day Then
  27. MsgBox("Trial expired!")
  28. End If
  29. End If
  30. Else
  31. If month = My.Settings.month + 2 Then
  32. msgbox("Trial Expired!")
  33. Else
  34. If month <> My.Settings.month + 1 Then
  35. MsgBox("Trial Expired!")
  36. End If
  37. End If
  38. End If
  39. End If
  40. Else
  41. 'If the year is different, the trial has expired
  42. MsgBox("Trial Expired!")
  43. End If
  44. 'If there is an error, make a msgbox containing the error
  45. Catch ex As Exception
  46. MsgBox(ex.Message)
  47. End Try
  48. End If
  49.  
  50. End Sub
  51. End Class

URL: http://brandonsoft.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.