Cal.B
Cal.B

Reputation: 88

"TryCF" in Visual Studio 2015 (VB.NET)

I just found the very handy "TRYCF" hotkey in VS2015 - for those unaware, you can type "trycf", hit tab and it lays the following out for you:

           Try

        Catch ex As ArgumentException

        Finally

        End Try

This would be amazing, and would save me a lot of time in my day to day coding, except the default exception type "ArgumentException" is no good for me, I just want to catch generic exceptions: "ex as exception"

Does anyone know how I can set VS2015 up so that the default exception is just an "exception"?

Cheers.

Upvotes: 1

Views: 127

Answers (1)

TnTinMn
TnTinMn

Reputation: 11801

You are invoking a code snippet. You could edit the snippet file and change the <Default> tag.
For VS2015, the path to those snippets is: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VB\Snippets\1033\common code patterns\exception handling".

A recommended alternative is to copy the subject snippet to your personal snippet folder.

C:\Users\UserName\Documents\Visual Studio 2015\Code Snippets\Visual Basic\My Code Snippets

Then edit it to change the <Default> tag. Also change the <ShortCut> tag so that it does not conflict with the pre-installed VS snippet.

Upvotes: 0

Related Questions