client4.png

Knowing Visual Studio for absolute beginners

Today we will be discussing Visual Studio 2013. Microsoft Visual Studio has a very important role in making developers’ life easy and it is irritating to work on other IDE’s if someone like me is addicted to Visual Studio environment. This is a very big topic that will be covered in many articles but if you are looking for the very basics then you have come to the right place.

So let’s get started with familiarizing ourselves with MS Visual Studio 2013

Programming Languages Support:

If you have VS 2013 Ultimate installed, go to “file” in menu bar, select “New” and then select “New project”; you will see variety of languages in which you can work and complete your work.

Some of them are:

  • Visual Basic
  • Visual C#
  • Visual C++
  • Visual F#
  • JavaScript
  • Python

projects

Project Types:

For every single language you have multiple types of projects that help programmers by auto generating code structure. For example, for Visual C#, you can make:

  • Console Application
  • Form Application
  • Class Libraries
  • WPF Application
  • ASP.Net Web Application and many more

Once you have selected you desired programming language and its project type, you have to enter project name, location and solution name. “Location” indicates the path on your storage device where your project will reside and “Solution name” is the name of workspace (called solution here) in which you can make multiple projects. Once all the information is entered, click “ok” so that visual studio will set your working environment ready according to your selected options.

Solution Explorer:

Now your screen is divided into multiple blocks. The main area (text editor) is the area where you write code. You have “Solution Explorer” on the right side; if not, go to “View” and select “Solution Explorer” or press “Ctrl + Alt + L” in windows. “Solution Explorer” has the complete directory and file wise view of your project. That is, the top most thing is your solution (workspace) under which there are projects and under projects there are files of that project.

Whenever you add file in your project without visual studio, that is using file explorer, you have to refresh the solution explorer.

solution explorer in visual studio

By right clicking on the project you can see a list of options including:

  • Building project
  • Cleaning Project
  • Adding new files in project
  • Adding new instance of Solution explorer
  • Loading/Unloading project
  • Deleting/renaming project
  • Opening project in file explorer
  • Opening in Blend if supported and many more

Screenshot (76)

 

Inside the Text Editor:

Now in the code area you can do many things, out of which few are listed below:

  • You can add “break point” on any line of code by double clicking in the left most bar in the IDE (Integrated Development Environment) or the code area and a red dot will appear as shown in the screen shot below. This red dot means that when you run the code in debug mode, it will stop at this line and then you can debug the code line by line by pressing F10 (step over). For going into the function call or some thing related to it, press F11 (step into) and for moving out of the function definition, press shift + F11 (step out). The major benefit of it is that you can see the values of every variable used in the bottom panel or by just hovering the mouse pointer over the variable whose value you want to check. You can also change the value at run time for testing purposes. While debugging, on the right side, you will see “IntelliTrace” which is the stack for all the exceptions and other related event triggers.
  • By right clicking on any function and selecting “Go to Definition”, visual studio opens the definition of the function for you.
  • You can select one word in the code and visual studio will highlight all the words matching it in the code file for you and you will know where that word is being used.
  • You can email the code snippet by right clicking and selecting “Email code snippet”.
  • You can insert snippet (like if statement, for loop, while loop, foreach loop etc.) by right clicking anywhere in the code area and selecting “Insert Snippet” and then selecting your desired snippet.
  • You can also surround the selected code structure by right clicking, selecting “Surround with…” and then selecting your desired snippet (for example, surround it with if condition, try catch block, for loop etc.).

MS Visual Studio Productivity Power Tools

Productivity Power Tools is a set of extensions for visual studio professional and above to improves developers’ productivity. You can download it here. Once you have installed it, you will find it under “Tools”, under “Options” and under “Productivity Power Tools”. It has about 19 different extensions in it. Few of them are listed below:

  • Ctrl + Click Go to Definition
    • By doing this a dialogue box will open which will include the details about the work you clicked.
  • Peek Help
    • By right clicking and selecting peek help, it will open relevant section for you from MSDN website.
  • Solution Explorer Errors
    • Enabling this extension will help you detect errors by underlining the project and the file that have an error in it. And by hovering on the file in solution explorer it will give you the immediate response and show you the line number and the error it contains.
  • Double click to maximize window
    • By double clicking on any of the windows, you can maximize it and by double clicking again,you can restore it to its original size.
  • Match Margin
    • By enabling this extension, you will be able to match margins on the left side of your code editor area. It will help you to reduce scrolling and by just hovering on the line it will show you the header of that block.

This is it for today. I hope you will find this article helpful. For any queries, please comment.
Thank you for reading.

read more
Danyal MalikKnowing Visual Studio for absolute beginners