Auto-generate a try catch block in visual studio 2010

Using the mouse

  1. Mark your code

  2. Right-click

  3. Select Surround with...

  4. Double-click try

Using the keyboard #1

  1. Mark your code using Shift,
    Ctrl + A, or whatever works for you

  2. Press Menu key / Application key (alternatively Shift + F10)

  3. Type S

  4. Type T

  5. Press Enter or Tab

Using the keyboard #2 (as perlox and Fredrik Norlin points out)

  1. Mark your code using Shift,
    Ctrl + A, or whatever works for you

  2. Press Ctrl + K, followed by CTRL + S

  3. Type T

  4. Press Enter or Tab

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)