Drag and drop code from tool box in Visual Studio .NET
By Shivprasad Koirala
As a developer you always need some common codes again and again. Rather than writing those common codes from scratch you would like to get them easily from some handy place.
Visual studio and .NET tip 7:- Drag and drop code from tool box
As a developer you always need some common codes again and again. Rather than writing
those common codes from scratch you would like to get them easily from some handy
For instance when using ADO.NET you always need to write code for opening the connection
objects and closing them. So rather than writing this code again and again if
you can get them from some common place life would be much easy.
SqlConnection oConnection = new
// Write your custom logic here
For a developer the handiest place is the tool box and the good news is you can select
the code and pin in it on to the tool box. When needed you can select the code
from tool box and drag them on to your coding area.
You can also better organize your code by creating tabs on the toolbox for better
management as shown in the below figure.
Video for the above tip and trick:- http://www.youtube.com/watch?v=dIigx1VPfdg
Many times as a developer you come across functions with lots of input parameters as shown in the below code snippets. In real projects the input parameters would be much higher as compared to the below code snippets. Some times for various reasons you want to shuffle them, reorder them or remove some of them.
Many times due to project pressure and lazy attitude you violate encapsulation and create public variables for classes as shown below. Even though your inner heart knows that the best practice is to create set and get property function but your lazy attitude overrules it.
We all know exceptions get propagated from the last caller to the main caller. For instance let’s say from your static void main method you are calling “SomeMethod” and he in turn is calling “SomeMethod1”.
While debugging you often want to skip debugging on certain lines of code. For instance in the below code you have set the debug point to the first line, you would like to skip the in between lines and jump directly to “console.writeline” step.
In big project you have 100’s of classes and each of those classes can have lots of properties.
As developer debugging is your routine job and you would like your debugger to debug smartly rather than monotonously. For instance in the below code we have put a debug point and we do not want our debugger to just break monotonously.
Drag and drop code from tool box in Visual Studio .NET (2151 Views)