Sunday, 15 July 2012

c# - Delegate and event -



c# - Delegate and event -

i have 2 forms.

form1:

public partial class panel1 { public void showexport(object sender, eventargs e) { ....... } }

form2:

public partial class panel2 { public delegate void showexportreport(object sender, eventargs e); public event showexportreport showexportclicked; private void buttonexport_click(object sender, routedeventargs e) { if (showexportclicked != null) { showexportclicked(sender, new eventargs()); } } }

when click button -

button.click = buttonexport_click

how can phone call panel1.showexport() panel2.buttonexport_click?

in panel1 have subscribe event:

pnl2.showexportclicked += new showexportreport(showexport);

c# events delegates

No comments:

Post a Comment