Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

How can I perform an action every second?

Hi,
I want a program to calculate a random number every second.
Coding the random number I can do,but getting it to produce one every second has me stumpped.
I know it must have some thing to do with the timer but I can't figure it out.
Can someone help me?

thanks in advance
Ives
0
ives31
Asked:
ives31
1 Solution
 
DocMCommented:
'Put a timer control on the form
Private Sub Form_Load()
 Timer1.Interval = 1000
 Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
 Call MyAction
End Sub

Sub MyAction()
 'Your code
 Stop
End Sub
0
 
hj2k3Commented:
place a timer on the form, then set its 'interval' property to 1000, which is 1000 milliseconds which is 1 second. then double click on the timer. the code window will pop up, where you type the code you want to happen every second. to stop the timer, just set its Enabled property to False
0
 
ives31Author Commented:
thanks for your help.
I did actually figure it out just after I posted the question :)

Thanks again for your help :)
0
 
CleanupPingCommented:
ives31:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept DocM's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now