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
Post a Comment