how to gate array of timer in c# -


i want timer "foreach datavalue in _datavalues" storeed in array exp, timer[0]=timer0, timer[1]=timer1, timer[2]=timer2 etc.here code,

timer[] timer=new timer[50];  int = 0;  foreach (int datavalue in _datavalues)  {                   string a="timer" + i;                    timer[i] =a;      i++;      timer1[i].tick += new eventhandler(timer_tick);      timer1[i].interval = (1000) * (2);   } 

but provide error "cannot implicitly convert type 'string' 'system.windows.forms.timer' how value in timer[i]?any 1 can me? "

it not clear after. here wild guess:

timer[] timers = new timer[50]; string timernames = new string[50];  int = 0;  foreach (int datavalue in _datavalues) {          timenames[i] = string.format("{0}",i);      timer[i] = new timer();      timer[i].interval = datavalue;      i++; } 

it bad idea create 50 timers. if want have different intervals can done single timer too. create 1 timer shortest common interval.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -