dotnetN00b dotnetN00b - 2 months ago 13
Vb.net Question

Does C# have a Handles keyword?

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick


End Sub


In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

Answer

Nope. You will have to wire up the event like this

Menu1.MenuItemClick += Menu1_MenuItemClick;