0

Is there a way to customize/edit the default template of the event handling methods in Visual Studios 2008/2010 such that upon creation, the event handler already has a try/catch block in it?

the default behavior is

    private void button1_Click(object sender, EventArgs e)
    {
    }

I'd like to be able to set the development environment to do

    private void button1_Click(object sender, EventArgs e)
    {
        try
        {
            ///TODO: Add logic here
        }
        catch
        {
            throw;
        }
        finally
        {
        }
    }

I've already edited the templates located in the ItemTemplates folder so that they meet the coding standard where I work, but I'd also like to edit the method templates if possible. I've searched the 'Net for the better part of a week and found nothing. Any assistance would be greatly appreciated.

Tim
  • 3
  • 1

1 Answers1

0

![Snippet Manager1

Have you considered Editing Event method stub in the Code Snippet manager or adding a new snippet?

Sabitha
  • 243
  • 1
  • 5
  • I had not even looked there. (truthfully, I didn't even know that functionality existed.) I'll check out the Snippet manager, and let you know if that works. – Tim Mar 01 '11 at 19:31
  • So, I looked in to the Snippet Manager. While it did provide some functionality and allowed me to fix some other issues; I was unable to force VS2010 to use the newly modified snippets. Thanks though. – Tim Mar 07 '11 at 18:24