Welcome to MSDN Blogs Sign in | Join | Help
Code-Snippets in .Net

Last week I had to do a small project within Visual Basic. I wrote a database layer with 3 classes and used it from the Business-Logic – and the BL was called from the GUI (a typical 3-tier application J).

After programming for about ½ hour, I recognized that I have to do a lot of work in the declaration-writing of every function within the BL. I’ll give you an example:

 

Dim dbAccess as new BMODataBase.DBAccess()

dbAccess.LocalDB = MySettings.DataBaseConnection

dbAccess.SQLCommand = BMODataBase.SQLCommand.SelectStatement

 

After doing those more than 2 times, I did it with Cut&Paste J

 

Then I recognized, that I had many compile-errors. The cause was, that most of the code is identical – most, but not everything. So I asked myself: is there a possibility to minimize the compile-errors without writing code as much ?

 

YES – there is something: call Code-Snippets !

 

A very simple way to define your structured code what the IDE have to insert, with the possibility that the IDE asks you about the last 20 % of the code which might be different – and the best of this story: your Code-Snippet is fully IDE- intellisense !!

 

I don’t want to describe in detail how you write your own snippet and which tool you have to use, because there is already a VERY good and short article about that:

http://msdn.microsoft.com/vbasic/default.aspx?pull=/msdnmag/issues/06/04/AdvancedBasics/default.aspx

You will find the tool to write your code-snippet on: http://msdn.microsoft.com/vbasic/downloads/tools/snippeteditor/

 

Write your code more easily and with less compiling errors - without Cut&Paste – do it with Code-Snippet ! Have fun J

Posted: Thursday, April 13, 2006 5:28 PM by Robert John
Filed under:

Comments

No Comments

Anonymous comments are disabled
Page view tracker