cancel
 

 

Job type :

Zip Code :

community forums

Featuring over 100 topics of interest to DoItYourselfers.

How to Create a C# Project in MS Visual Studio 2005

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Video Transcript

Launch a new instance of Visual Studio. We are going to work with C#'s, so let us create a C# project. Select File, New, Project. Let us choose a windows application in C#. We will give it a name. In this case we are going to be working with code snippets. So let us give it a name, "Working with code snippets." And now click "Okay."

In this section, we will be working with code snippets. Double click on your form to go to the code editor. Code snippets work the same way in C#. All you have to do is right click on your code editor and select insert snippet. This gives you a list of snippets that are available in C#.

Let us work with some of them. Scroll down and select the F snippet. This automatically generates an F lock for you that you can generate with your own code. Delete this. Right click and insert a new snippet. In this case, we will add up foreach loop. Scroll down, select foreach and now you can see it automatically created the shell for middle loop through a collection.

What if I want more than this? What if I want more snippets? There is a way to add more snippets in the language that you are working with. You can do this with the Code Snippet Manager. Click on Ctrl+Z to undo. Now let us work with managing code snippets. You can download more C# snippets from an MSTN. Let us go ahead and download additional snippets and along the way you will learn how to work with the Code Snippet Manager.

Let us open up an instance of our browser. Let us navigate to a location where the snippets are located. In the address box, type in MSTN.microsoft.com/bstudio/downloads/codesnippets. This takes us to a page where we can download Visual Studio 2005 code snippets. I can see that I can download all the C# code snippets that are available. Scroll down a little bit further. I can see that there are database code snippets, math code snippets as well as security code snippets all available for C#. Let us download them all. Select the download all C# code snippets button.

After you review the license, select I accept. Go ahead and run this file. Accept the security warning and click Run. Navigate through the setup wizard. Select "I agree" and click "Next." Accept the default location and click "Next." Select "Next" again and wait while the snippets are being installed. Once the install is complete, you will see the director where the snippets are stored. Go to the address bar and copy that location. Select Ctrl+C to copy it in the memory and close this up. Select Close to complete the installation and close your browser. Now you are back to Visual Studio.

Earlier we had customized our toolbar. One of the elements that we added to our toolbar was the Code Snippet Manager, click on that. Here is a tip: Another way to bring this up is using the code, Ctrl+K, Ctrl+B. The code snippets manager allows me to look at the different snippets I have for a variety of languages. If I click on the language dropdown I will see Visual Basic, C#, J#, and XML snippets available.

In this case, I want to work with C# so I will select that. As you know, we have just downloaded some more C# snippets. In order to add this, all I have to do is simply click on the Add button. And because you are at the location of the snippets stored in memory, hit Ctrl+D and select Enter. I now have my visual C# 2005 code snippets downloaded it into my code snippets manager. I have other options here. If I wish to remove a directory. I simply have to press the Remove button. If I want to import new snippets, I select the Import Option. This allows me to import one or more snippets. I can also search online for more snippets. If I expand the Visual C# 2005 code snippet directory, I can see I have a variety of new snippets that I can work with on my file system. Select Okay to accept these changes.

In your code designer, right click and select insert snippets. And now, I see more choices. I have my original Visual C# components. I also have Visual C# 2005 code snippets. These are the new ones that I have just downloaded. Let us explore. Select the second code snippet package.
Launch a new instance of Visual Studio. We are going to work with C#'s, so let us create a C# project. Select File, New, Project. Let us choose a windows application in C#. We will give it a name. In this case we are going to be working with code... click to read more


Decorating For Thanksgiving

sponsored articles of the day

diy centers

Research and explore a wealth of wisdom on these topics