vb.net - (VB) Timer carries on other forms -


basically, when continue onto next form timer still running, how can stop this? have used "timer1.enabled = false"

private sub timer1_tick(sender object, e eventargs) handles timer1.tick             msgbox("sorry, time has expired. please try again.", vbokonly, "warning")             me.close()         end sub 

i think using windows timer.

if true first message box has unwanted side effect accumulate number of tick events in message queue of program.

more time stay in video message box displayed more message boxes displayed because messages accumulate in queue

you try solve situation global form variable

dim timeelapsed boolean   private sub timer1_tick(sender object, e eventargs) handles timer1.tick    if timeelapsed = false         timeelapsed = true ' important set immediatly true         msgbox("sorry, time has expired. please try again.", vbokonly, "warning")         me.close()         dim t = ctype(sender, timer)         t.elapsed = false    end if end sub 

also check hans passant advice disposing of timer


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -