1

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.

Cal.B
  • 88
  • 9
  • You are invoking a code snippet. You could edit the snippet file and change the `` tag. The path to those snippets is: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VB\Snippets\1033\common code patterns\exception handling". – TnTinMn Mar 08 '16 at 16:50
  • You talking about code snippets: [Walkthrough: Creating a Code Snippet](https://msdn.microsoft.com/en-us/library/ms165394.aspx). You don't need to overwrite default snippets just create your own with your own shortcut word – Fabio Mar 08 '16 at 17:57
  • Thank you for your help! @VisualVincent - That's a useless, unhelpful comment. The question is regarding the Visual Studio 2015 IDE, a tool used every day by millions of programmers. Although the question isn't specifically about programming, where else would you expect that I ask it? If you don't have anything useful to contribute, don't contribute at all. – Cal.B Mar 09 '16 at 09:27
  • @TnTinMn if you want to put your comment as an answer, i'll mark it as correct - this really helped me out. Thanks a lot!! – Cal.B Mar 09 '16 at 10:39
  • @Cal.B : I said it because questions like this are typically marked as off-topic, and I wanted to tell others that I feel so (in case anyone agrees). But if you'd like I can flag it instead. Other forums for help with general software stuff includes for example SuperUser. – Visual Vincent Mar 09 '16 at 11:24
  • @VisualVincent there shouldn't be a "Visual Studio 2015" tag if it's considered "off topic". here are some others you can flag while you're at it http://stackoverflow.com/questions/31553560/visual-studio-2015-very-slow?rq=1 http://stackoverflow.com/questions/32122660/how-to-change-the-vb-net-language-version-in-visual-studio-2015?rq=1 http://stackoverflow.com/questions/32298292/visual-studio-2015-intellisense-keyboard-options?rq=1 http://stackoverflow.com/questions/34292149/visual-studio-2015-vb-net-how-to-find-record-in-ms-access-database-and-disable-b?rq=1 – Cal.B Mar 09 '16 at 11:56
  • I'm not going to flag your question. But some questions are specific to that version of VS too, not necessarily the application itself. I've seen questions before that has been marked off topic in situations like this. Sorry I cared. – Visual Vincent Mar 09 '16 at 12:21
  • There, comment deleted. – Visual Vincent Mar 09 '16 at 12:24
  • Note: Catching `Exception` in a lot of places is a code smell ("Pokemon exception handling"). You *might* want to replace that with a single global exception handler, but it's hard to say without knowing your current situation in detail, so take this (unsolicited) advice with a grain of salt. – Heinzi Mar 16 '16 at 13:59
  • @Heinzi - thanks dude, but there are different types of handling that we do. Often (because of the ugly API we use), I have to have some infinite while loops to sniff out objects in an iterative way until no more objects can be found (then in the catch, we exit while). – Cal.B Mar 17 '16 at 15:42

1 Answers1

0

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.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
TnTinMn
  • 11,522
  • 3
  • 18
  • 39