Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to complete a Visual Studio snippet in VB.NET?

In C# if you start a snippet you press Tab to cycle through the snippet elements, and press Enter to complete and exit the snippet.

In VB.NET you still use Tab to cycle through the snippet elements, but how do you end the snippet? Enter doesn't work and I can't figure out the correct keyboard shortcut

like image 525
kenwarner Avatar asked Jan 28 '11 17:01

kenwarner


People also ask

What is snippet vb net?

Code snippets are highly customizable code fragments intended to accomplish simple to intermediate tasks quickly; they can be inserted into your code with just a few keystrokes. You can insert IntelliSense Code Snippets using the Code Snippet Picker or typing the shortcut name of the snippet and pressing Tab.

How do I add a code to a snippet?

On the menu bar, choose Edit > IntelliSense > Insert Snippet. From the right-click or context menu in the code editor, choose Snippet > Insert Snippet.


1 Answers

VB snippets don't work the same way as C# snippets. VB snippets don't have an 'end' and instead stay active until you start typing outside of the snippet scope. The best method is to press esc (once or twice depending on your current selection) and then use the arrow keys to navigate.

A great demo video is available on MSDN. It focusses mostly on C# but has some explanation of the VB snippets at the end.

For more information check out the keybinding posters

like image 59
bstoney Avatar answered Oct 09 '22 09:10

bstoney