The VB language supports the “handles” statement — which allows you to
wire-up the bindings to event handlers on the event handler methods themselves.
Although you can also explicitly wire-up event handlers using the server control
declaration (onclick=”button1_click”), VB developers typically expect/prefer
using the Handles keyword instead.
C# as a language doesn’t have a concept like the “handles” keyword.
Instead, you must explicitly wire-up event definitions.
i.e., VB developers can use either method but C# developers must explicitly wireup events.
You may set AutoEventWireup=”true” for VB.Net.
In VS.Net 200x, this means that you can skip the “Handles ….” statement,
provided the method is named correctly.
E.g., if you have AutoEventWireup set to true, this method in a Codebehind file would handle the
Click Event of the Button Control with ID “Button1″ without using onclick=”Button1_Click”
Sub Button1_Click(ByVal s As Object, ByVal e As EventArg)
‘ Look, no Handles
If you set AutoEventWireup=”false”, you would need to add the Handles:
Sub Button1_Click(ByVal s As Object, ByVal e As EventArg) Handles Me.Button1.Click
‘ Need Handles
void Page_Load(Object sender, EventArgs e)
// Manually register the event-handling method for the Click
// event of the Button control.
Button1.Click += new EventHandler(this.SubmitBtn_Click);
void SubmitBtn_Click(Object sender, EventArgs e)
Button Click Example
Click the Submit button.
Here is some good links talk about the AutoEventWireup