|
-
Mar 20th, 2003, 04:09 PM
#1
Thread Starter
New Member
Timer
Im trying to put a delay between the button click and the message box that pops up. Here is my code, please help me out with this.
Private Sub TimerFire()
Me.Timer1.Interval = 3000
Me.Timer1.Enabled = True
End Sub
Private Sub TimerStop()
Me.Timer1.Enabled = False
End Sub
Private Overloads Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TimerFire()
MsgBox("ok")
End Sub
Crystal Reports beheaded!
-
Mar 20th, 2003, 04:15 PM
#2
Sleep mode
Re: Timer
try this
[code]
Private Sub TimerFire()
Me.Timer1.Interval = 3000
Me.Timer1.Enabled = True
MsgBox("ok")
Me.Timer1.Enabled = False
End Sub
Private Overloads Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TimerFire()
[/Highlight]
-
Mar 20th, 2003, 04:19 PM
#3
Thread Starter
New Member
Timer
Still does not work. There is no delay I cut and pasted the aforementioned code which looks like this now:
Private Sub TimerFire()
Me.Timer1.Interval = 3000
Me.Timer1.Enabled = True
MsgBox("ok")
Me.Timer1.Enabled = False
End Sub
Private Overloads Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TimerFire()
End Sub
Crystal Reports beheaded!
-
Mar 20th, 2003, 04:23 PM
#4
Sleep mode
Re: Timer
Sorry , I mean this way !
VB Code:
Private Sub TimerFire()
Me.Timer1.Interval = 3000
Me.Timer1.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TimerFire()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MsgBox("ok")
End Sub
-
Mar 20th, 2003, 04:29 PM
#5
Sleep mode
Re: Re: Timer
stop your timer when you're done !
VB Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MsgBox("ok")
Me.Timer1.Enabled = False
End Sub
-
Mar 20th, 2003, 06:10 PM
#6
Thread Starter
New Member
Timer
Thank you for your time. I really appreciate it. Heres another easier (my pov) delay method that I found elsewhere on this forum:
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Private Overloads Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Sleep(1250)
MsgBox ("ok")
End Sub
Crystal Reports beheaded!
-
Mar 20th, 2003, 06:40 PM
#7
Sleep mode
Re: Timer
No problem .... You can do something alike with threadings . It has sleep , pause , resume methods .
-
Mar 20th, 2003, 07:41 PM
#8
Fanatic Member
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Sleep for 3 seconds
Threading.Thread.Sleep(3000)
'Show MessageBox
MessageBox.Show("Ok!")
End Sub
simple code, makes the thread the code is running in pause for 3 seconds.. which would make your program pause before showing a message box
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
|