Software Technology Tips


Visual Studio 2008 makes life very easy for a developer. We can have complete code blocks created automatically. This is at a very advanced level for VB.NET and is still evolving for C#.

More Details:

Right Click and select "Insert Snippet" from the context menu [Or] use Ctrl + K + X and you will see a menu which lists all available options which are neatly grouped.

Just for a sample, I used the insert Snippet to create a code block to "Call the ExecuteReader Method of a SQLCommand" - the following lines were produced automatically:

         Dim reader As SqlDataReader

        Dim previousConnectionState As ConnectionState = conn.State


            If conn.State = ConnectionState.Closed Then


            End If

            reader = cmd.ExecuteReader()

            Using reader

                While reader.Read

                    ' Process SprocResults datareader here.


                End While

            End Using


            If previousConnectionState = ConnectionState.Closed Then


            End If

        End Try

Some available snippets are listed below:

For C# Code Behind Files


if, Region, Checked, Class, Else, Enum, for, foreach, if, indexer, try, while, Etc.


DependencyProperty Event handler & property.

For VB.NET Code Behind Files

This is a programmer's delight. The list is very exhaustive. Some samples below:

Code patterns like if, if else, try Catch, property.

Data - ADO.NET - Create a parameterized SELECT Command, Execturereader, Etc.

Data - LINQ - From..Select, From..Order By...Select, Etc.

Collections and Arrays, FileSystems, Math

Office Development

Connectivity, Crystal Reports, Security, Workflow

Smart Devices

Windows Forms – Drawing, Etc



The list is almost endless. See it to believe it...

Statutory Warning!

The use of this feature may lead to code that is NOT in synch with the coding standard on naming conventions of your project/team. So take care of this point.

Happy programming! 

Related Tags:

MS Visual Studio, IDE

Author: Sathyan R


Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome  DB Stpi

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login