c# - Use a Timer to change value periodically -


Hi there I'm new to C # and just want to run a timer manually! So I want to know what I am doing wrong in my code. I need to display a simple message within my timer! My code is:

  Public Partial Category Form 1: Form {System.Timers.Timer time; Public Form 1 () {Initialization (); Time = new system Timer Timer (); time. Interval = 10; Time.Enabled = true; time.Start (); } Private Vain Time-TAT (Object E, EventErgages EA) {For (Int i = 0; I   

Please tell me if I am doing something wrong thanks in advance!

You forgot to hear ended event:

  time.apple + = new ElapsedEventHandler (time_Tick);   

For the initialization of the timer and call the callback function when the timer is over (10 mm time)

Note that the callback function will also be every is called 10 ms. time.Stop (); inside the callback function if you want to stop it.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -