Ok Im a begginer to VB.net and am taking a course in school. I have been thinking about making a bps counter (for those of you who dont know its a program that sees how many paintballs you can shoot in a certain period of time) I have no idea how to do the timer part. What I want it to do is when u click on the button to start shooting the timer starts counting down and when it gets to the end the button is dissabled(making you use the reset button to start again) If anyone could help me with a script for the timer part and some partially detailed instructions as i am quite new to this that would be great.

Thx in advance

Below is the code that will hep you


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Interval = 10000 '10 sec
Timer1.Start()
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Button1.Enabled = False 'As 10 sec are over disable buttton1
End Sub

:)


Ok Im a begginer to VB.net and am taking a course in school. I have been thinking about making a bps counter (for those of you who dont know its a program that sees how many paintballs you can shoot in a certain period of time) I have no idea how to do the timer part. What I want it to do is when u click on the button to start shooting the timer starts counting down and when it gets to the end the button is dissabled(making you use the reset button to start again) If anyone could help me with a script for the timer part and some partially detailed instructions as i am quite new to this that would be great.

Thx in advance

Keeping in mind using the Tick method, over a 10 sec. span, it can be off by as much as 550 milisec. on the count, or so it said when I did a search on timers in VS.
I've found the search in VS to be of major help. My $.02

GaryR

thanks that should help greatly and the timing being off isnt so important as its just a rough estimate of how fast a person would be able to pull a paintball gun trigger

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.