I don't believe that C# has a direct equivalent to the Handles keyword. You have to wire event handles elsewhere using the += operator. For example, Visual Studio automatically wires events in InitializeComponent(), which is called by Page.OnInit(). Look up
the += for more info. Also, here is a cool table of language equivalents: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxgrfLanguageEquivalents.asp
this.Load += new System.EventHandler(this.Page_Load);
this type of setup uses delegates to accomplish the event handling and replaces the publisher/subscriber pattern needed in Java (in case you were curious).
nileshr
Member
65 Points
13 Posts
Equivalent of Handles Keyword in VB.NET in C#
Sep 28, 2004 08:33 AM|LINK
bennage
Member
75 Points
13 Posts
Re: Equivalent of Handles Keyword in VB.NET in C#
Sep 28, 2004 02:05 PM|LINK
aw232
Member
610 Points
120 Posts
Re: Equivalent of Handles Keyword in VB.NET in C#
Sep 28, 2004 03:07 PM|LINK
private void Page_Load(object sender, System.EventArgs e) { //enter code here }then in the OnInit method you'd say this type of setup uses delegates to accomplish the event handling and replaces the publisher/subscriber pattern needed in Java (in case you were curious).