ShareThis

Sunday, August 4, 2013

[C#] WinForms - How to add your own methods to Control functions [with anonymous methods]

Adding your own methods to event handlers on controls is super easy.



Example 1
txtDataReceived.Click += delegate { foo(localVariable1,localVariable2); };
Example 2
imgbtn.Click += delegate { lbl.Visible = false; DoPostBack(); }; 

2 comments:

Adding custom methods to Control functions in C# WinForms can streamline your application development. Tools like ModEngine2 make integration and functionality enhancements much simpler.

Post a Comment