|
-
Mar 17th, 2005, 09:19 PM
#1
Thread Starter
Lively Member
Questions on timer class and progressbar
Hi everybody
Below is a section of basic codes on how to use the timer class. May i know is there anyway i can implement a progressbar to indicate the 1 second interval for the timer class ? Thank you very much.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRx.Click
Timer1.Interval = 1000
Timer1.Enabled = True
'Do something if they respond ???
'If they respond in time turn off the timer
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MessageBox.Show("Times Up!", "Timer")
End Sub
-
Mar 17th, 2005, 09:31 PM
#2
Re: Questions on timer class and progressbar
Something like this...
VB Code:
Private iKounter As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRx.Click
Progressbar1.Max = 10
Progressbar1.Value = 0
Timer1.Interval = 1000
Timer1.Enabled = True
iKounter = 0
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
iKounter = iKounter + 1
Progressbar1.Value = Progressbar1.Value + 1
If iKounter = 10 Then
Timer1.Enabled = False
MessageBox.Show("Your 10 seconds are up!", "Timer")
End If
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|