VB.NET - Expire the Application - Error: System.FormatException: String was not recognized as a valid DateTime.

  • Thread starter Thread starter Sergio R Siqueira
  • Start date Start date
S

Sergio R Siqueira

Guest
Hello,
I'm trying to put my programs to expire on a date determined by me.
I am using the code below, but when I run the executable, it gives an error message: System.FormatException: String was not recognized as a valid DateTime.
If I click "Continue," the program runs normally, and also expires when you give the date to expire.
but I would like to get this error every time I run, what is wrong with my code?

Thank you very much in advance.


'Expiração do programa
Dim dt1 = DateTime.Now
Dim dt2 = DateTime.Parse("30/09/2019")

If dt1 >= dt2 Then
MsgBox("Expirou a Validade - Favor Contactar o Administrador")
Application.Exit()
Else
Application.Run()
End If

Continue reading...
 
Back
Top