Re: delay/timer function?
Add a timer component to the form, set the interval to 1000. That will do the timing, but you will need to change the logic. Whenever the timer runs down it raises the tick event, so you won't have your loop in one place the way you currently do. Instead, have a counter variable (an integer) at form scope. In the timer tick event, increment that counter and check whether it is 10. If it is, disable the timer. As long as it is not 10, change your labels accordingly.
Re: delay/timer function?
i want to run the timer again and again for 10 times.
Re: delay/timer function?
You already mentioned that, what you mean is that you want to run your code 10 times. As already explained a timer runs every second, you control how many times it runs by stopping and starting it. There is another method, but unless you want the side effects I would use SH suggestion first.
Re: delay/timer function?
1. Add a timer to your form. Set the interval to 1000, enabled to true.
2. Double click on the timer you've just added to the form. This will create a Timer.Tick event handler for you in code. You then paste this inside that sub:
Code:
Static counter as integer = 0
'Display the current value of counter
Label1.Text = counter.ToString()
'Increment counter by 1
counter += 1
'Reset counter back to 0 if it's > 10
If counter > 10 then
counter = 0
End If
Re: delay/timer function?
now got the concept. thanks. i was think to repeat the timer with the loop.