Many times during our development, we face situations where we need to perform some basic tasks like reading/writing from file, sending email and etc.
Visual Studio.NET has these all present in the form of Code Snippets.
Let us quickly explore that
Code Snippets are basically managed blocks of code which you can import to your project, and use them to increase your productivity and efficiency.
Visual Studio 2005 has a very nice set of code snippets of every language i.e. C# and Visual Basic.net etc.
Basically they are nothing but XML files with [ .snippet ] extension. You can import these files ( except the by default ones which are already part of Visual Studio) to be part of your code. Moreover, you can share your snippets with others as well as use Others's snippets to your project.
You can also go to http://www.gotcodesnippets.com/ web site to search for different code snippets of your choice.
Or, at the end of this post, you may want to make your own code snippets ....
You can download the Microsoft Code Snippet Editor for Visual Basic 2005 at http://msdn2.microsoft.com/en-gb/vbasic/ms789085.aspx
To see the detailed list of snippets you can go to Tools Menu > Code Snippets Manager, this will show you the list of snippets shipped for each language.

Also, as the picture shows you that you can also search online for Code Snippets. An interesting thing will be to explore the structure of the snippet files.
Lets do that !
Go to the Visual Studio.NET installation folder typically " C:\Program Files\Microsoft Visual Studio 8 "
Here you can find folders for VB, VC#,VJ# etc. Double click on VB folder to go inside.... while there will be a folder called as "Snippets"
The reason to tell you this way instead of writting the whole path is that you may require to go (may be C#) to other languages folder except VB.
The complete path to the snippets folder will be "C:\Program Files\Microsoft Visual Studio 8\VB\Snippets\1033\"
While inside that folder you may find different folders which refer to different categories of the code blogs, i.e. for filesystem related code snippets, I would go to
"D:\Program Files\Microsoft Visual Studio 8\VB\Snippets\1033\filesystem"
Let me select an snippet file called as "GetInformationAboutaFile.snippet". As the name refers, this file gets the information about a file into a fileinfo object.
The file has different sections which are as follows.
<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Get Information About a File </Title>
<Author>Microsoft Corporation</Author>
<Description>Obtains an object containing information about a file.</Description>
<Shortcut>filFileInfo</Shortcut>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>System.IO</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>Filename</ID>
<Type>String</Type>
<ToolTip>Replace with the file name.</ToolTip>
<Default>"C:\Test.txt"</Default>
</Literal>
</Declarations>
<Code Language="VB" Kind="method body"><![CDATA[Dim fileData As FileInfo = My.Computer.FileSystem.GetFileInfo($Filename$)]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
In the above, things to note are the Header section, where you can specify the title, author, description and the shortcut.
The shortcut is nothing but a way to include the code snippet into your solution. There can be two ways to include the code snippet to your solution.
1 - Right click in the code window and select "Insert Snippet" , and then follow the context menu options to select the appropriate snippet of your choice
2 - Simply type the shortcut of any specific snippet in your code window and press TAB. This will automatically include the complete code snippet to your solution.
Following diagragam shows the right click method of inserting the code snippet
With the <Snippet> tag, the actuall snippet starts. This tag is followed by the <Imports> section which can include multiple include of namespaces required to that code
snippet to work. Second, comes the declaration section whereyou specify the Literals with their ID, Data Type , Tooltip and a Default value i.e. default value (if any).
Finally, comes the Code section, preceeded by Code tag with Language specification and etc. The actual code is preceeded by
<![CDATA[
.
.
.
]]
As you saw in the snippet code that the variable we declared within the declaration Tag, is here with $Filename$. The $Filename$ is the Literal which (when snippet is included in code) will be replaced by its associated value in your solution.
<

Moreover, code snippets not only can be used for vb.NET or c#.NET code but you can simply put your HTML code into it and can insert in an .html file or .aspx file.
Happy coding !!!!