Placing your own reusable code into toolbox in visual studio and making use of it

While doing coding sometimes we need to write the same piece of code . So, generally what we do is we just copy it and paste it at desired place. For example:-  Suppose we have some piece of code that is meant  for  Exporting gridview data to excel. So,when we have are in need of such work we usually copy that piece of code and place it exactly where we want it.

But most of us are unknown to one of the best feature of Visual studio that,  we can save our piece of code in the toolbox and we can easily make use of it.

For this we just need to Select the code and drag it to the general tab. Let me show the steps.

Step 1: Select the desired piece of code and drag it to the general tab.

 drag.png

Step 2: We can also rename our code snippet by just right clicking and selecting the rename option and make use of it in future.

 rename.png

 

Ebook Download
View all
Learn
View all