|
-
Apr 4th, 2007, 08:05 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] how to set time?
how do i set that if ten second is gone, then do something, for example, it will close form1 then display form2...
-
Apr 4th, 2007, 08:06 AM
#2
Fanatic Member
Re: [2005] how to set time?
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.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Apr 4th, 2007, 08:09 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] how to set time?
 Originally Posted by 18experience
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^^
but how about just run one time?
-
Apr 4th, 2007, 08:14 AM
#4
Fanatic Member
Re: [2005] how to set time?
In the Tick Event, the last thing you do is set
Timer1.Enabled = False
That will stop the Tick Event from firing.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Apr 4th, 2007, 08:16 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] how to set time?
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
i hv written the method, but when i run it, the error is ObjectDisposedException, how can i solve it?
-
Apr 4th, 2007, 08:35 AM
#6
Re: [2005] how to set time?
You are trying to use the Show method of the Me object after youve closed it.
Change it to this:
VB Code:
Dim form2 As New Windows.Forms.Form
form2.Show()
Me.Close()
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.
-
Apr 4th, 2007, 10:41 AM
#7
Thread Starter
Hyperactive Member
Re: [2005] how to set time?
Great, the question is exactlly resolved! thank you^^
-
Apr 4th, 2007, 11:11 AM
#8
Fanatic Member
Re: [2005] how to set time?
Then please mark the thread as resolved.
Go to the Thread Tools menu at the top of this thread, it is in there.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|