Stupid question, but...
I want to show my second form only when time will be exactly 08:00:00 and again at 15:00:00.
Kinda works - it shown msgbox when time does not match, but if it match, form2 constantly opens when I close it, althought it should open only once and immediately should open msgboxes every one seconds, because time does not match.
Second, I set the interval to 0.5 sec to check time (because there can be mismatch!), but the msgbox still opens every 1 second. Of course it´s also altered inside timer in properties.
Code:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Enabled = True Timer1.Interval = 500 End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = Date.Now.ToString("HH") Label2.Text = Date.Now.ToString("mm") Label3.Text = Date.Now.ToString("ss") If Label1.Text = "08" And Label2.Text = "00" And Label3.Text = "00" Then Form2.Show() Timer1.Stop() Timer1.Start() Else MsgBox("Time does not match, sorry!") End If If Label1.Text = "15" And Label2.Text = "00" And Label3.Text = "00" Then Form2.Show() Else End If End Sub




Reply With Quote
