Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
pls help me on this...my code is in below.........

VB
Private Sub Form_Load()
time1.Text = "1100"
time2.Text = "1700"

End Sub

Private Sub Timer2_Timer()
lblTime.Caption = "Current Time : " & Format(DateTime.Now, "HH:MM:ss")

AM = time1.Text & "00"
PM = time2.Text & "00"
lblactualtime.Caption = Format(DateTime.Now, "HH:MM:ss")

If AM = Format(DateTime.Now, "HHMMss") Then
SendEmail
   

Else
    If PM = Format(DateTime.Now, "HHMMss") Then
    SendEmail
        End If
End If

End Sub
Posted

1 solution

Try this
VB
Dim sTime As DateTime = DateTime.Parse("4:00:00 PM") 'start
Dim eTime As DateTime = DateTime.Parse("6:00:00 AM") 'end
If DateTime.Now.CompareTo(sTime) >= 0 And DateTime.Now.CompareTo(eTime) <= 0 Then
'Do Something

End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900