winforms - C# timer stop after some number of ticks automatically -


how stop timer after numbers of ticks or after, let's say, 3-4 seconds?

so start timer , want after 10 ticks or after 2-3 seconds stop automatically.

thanks!

you can keep counter like

 int counter = 0; 

then in every tick increment it. after limit can stop timer then. in tick event

 counter++;  if(counter ==10)  //or whatever limit    yourtimer.stop(); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -