what would be the code for when i press a button, a timer waits for 2 secs (i know that is '2000') then opens another form.
thanks in advance
Printable View
what would be the code for when i press a button, a timer waits for 2 secs (i know that is '2000') then opens another form.
thanks in advance
VB Code:
Private Sub Command1_Click() Timer1.Interval = 2000 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Load Form2 Form2.Show Timer1.Enabled=False End Sub
Here is another approach:
VB Code:
Private Sub Command1_Click() Timer1.Enabled = False Timer1.Interval = 1000 End Sub Private Sub Command1_Click() Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Static i% i = i + 1 If i = 2 Then Timer1.Enabled = False End Sub
Oops, sorry about that:
VB Code:
Private Sub Form_Load() Timer1.Enabled = False Timer1.Interval = 1000 End Sub Private Sub Command1_Click() Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Static i% i = i + 1 If i = 2 Then Timer1.Enabled = False End Sub