c# - Passing value using an event -


so, first generate list containing custom usercontrols made of button , progressbar, generate using loop.

inside loop send each events desired methods, need access progress bar inside of reset method, how do that?

progresstimerlist[i].button.reset += button_reset; progresstimerlist[i].progressbar //////need access object 

and

 void button_reset(object sender, eventargs e)         {             //////inside of here         } 

create class inherited eventargs property of type progressbar , pass handler:

public class mybuttoneventargs : eventargs{     public --whateverprogressbartypeis-- bar {get;set;} }  progresstimerlist[i].button.reset += (sender, e) => button_reset(sender, new myeventargs { bar = progresstimerlist[i].progressbar });  void button_reset(object sender, mybuttoneventargs e) {     var wunderbar = e.bar; } 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -