Code snippet for 'protected void MethodName(object sender, EventArgs e)' method

When adding a method to handle server events (such as OnClick) I often found myself copying the Page_Load method and changing the name. I looked for a snippet which would create this method for me but had no luck, so I wrote one.

The snippet shortcut

Type evt then hit <tab><tab>

What the snippet outputs

protected void YourMethodName(object sender, EventArgs e)

The Snippet

Save this snippet in your snippet folder as evt.snippet (see the download links for this article)

The snippet folder is typically located here:

\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#

or here:

\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="">
    <CodeSnippet Format="1.0.0">
            <Description>Code snippet for 'protected void MethodName(object sender, EventArgs e)' method</Description>
            <Author>Paul Hayman</Author>
          <ToolTip>Method Name</ToolTip>
            <Code Language="csharp">
                <![CDATA[protected void $methodname$(object sender, EventArgs e)
Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo ( and is also the creator of GeekZilla.

Add Comment


Your comment has been received and will be shown once it passes moderation.