how do i set that if ten second is gone, then do something, for example, it will close form1 then display form2...
Printable View
how do i set that if ten second is gone, then do something, for example, it will close form1 then display form2...
Use a timer, set its interval to 10000 (ten seconds), and enable it. Place whatever code you want to run in the Tick Event of the timer and that code will run every ten seconds.
thank you^^Quote:
Originally Posted by 18experience
but how about just run one time?
In the Tick Event, the last thing you do is set
Timer1.Enabled = False
That will stop the Tick Event from firing.
i hv written the method, but when i run it, the error is ObjectDisposedException, how can i solve it?Code:Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim form2 As New Windows.Forms.Form
Me.Close()
Me.Show(form2)
End Sub
You are trying to use the Show method of the Me object after youve closed it.
Change it to this:
Note that you have to set the Shutdown mode setting to 'When last form closes' for this to work. Its located in the Project properties.VB Code:
Dim form2 As New Windows.Forms.Form form2.Show() Me.Close()
Great, the question is exactlly resolved! thank you^^
Then please mark the thread as resolved.
Go to the Thread Tools menu at the top of this thread, it is in there.