execute timer and the same time for loop statement

tang3li2

Member
Joined
Mar 2, 2011
Messages
8
Programming Experience
Beginner
hi guys can you pls help me out on this one?

i have this simple code on click button
note: the timer interval is set to 100

Private Sub btn_Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Submit.Click
Timer1.Enabled = True
For i = 0 To 100


Next
Timer1.Enabled = False
End sub


on the timer1 tick code i have this
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
test_timer += 1
Debug.Print(test_timer & " ms ")
End sub


the problem with this is that the timer1 is not excuting, i already put application.doEvents() on the form load and i also try to put it on the button click event..

what i want to do is to get the elapse time of the words i'm trying to find, it's like a dictionary program, i want to find a certain word and get the elapse time until the word is found...

thank you so much in advance
 
Last edited:
You can use a StopWatch to measure time, a Timer to display elapsed status in UI in intervals, a secondary thread to do processing. The BackgroundWorker component is often convenient to use in winforms for background work.
 
Probably doesn't help that you don't actually start the timer at any point!
"Timer1.Enabled = True" starts the Timer, but I agree with you that the post is hard to read when it is not formatted. Use code boxes when posting code! :)
 
Back
Top