winforms - Get source of event in C# Windows Forms -


i have list of string want create menu of toolstripitem (neither list size nor content know @ debug) , want each item execute same event, go through list code:

foreach (string in items) {     toolstripitem item = (toolstripitem)toolstripmenuitem1.dropdownitems.add(i);     item.click += new eventhandler(item_click); } 

the problem in item_click method need know of above items triggered event. if in wpf, have used routedeventargs , .source proprety since in regular windows forms app, i'm not quite sure how it. there simple way it? thank you.

use sender parameter in click event

var item = sender toolstripitem; if(item != null) {     ... } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -