Hello to everyone, Im new to vb.net and right now I am developing a program that its like a agenda where the user sets the date and the time do be remembered of the task the he has to do. Im storing the tasks in a txt file. The part when I set the time to, for example 21:30, a msgbox pops out saying "Alarm".But Im having trouble with the date, it gives an error every time I save the task into the txt file with the date on it.
So how can I see if the date of the computer its equal to the date in the txt file?
Heres the code that i have made:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
time_day = TimeOfDay.TimeOfDay.ToString
date_day = Date.Today.ToLongDateString
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim FILE_NAME As String = "C:\Users\Guilherme\Documents\database\data_base_tasks.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
If objReader.ReadLine.Contains(date_day) And objReader.ReadLine.Contains(time_day) Then
MsgBox("Alarm")
End If
Loop
Else
MsgBox("File Does Not Exist")
End If
End Sub