Must-Know Visual Studio Keyboard Shortcuts

Here, I will give you a short list of keyboard short-cuts for things you probably do often in Visual Studio.

Visual Studio Keyboard Shortcuts

Project Related Keyboard Shortcuts

  • Ctrl + Shift + B = Build your project
  • Ctrl + Alt + L = Shows Solution Explorer
  • Shift + Alt + C = Add new class
  • Shift + Alt + A = Add new item to project

Editor Related Keyboard Shortcuts

  • Ctrl + Enter = Insert blank line above the current line
  • Ctrl + Shift + Enter = Insert blank line below the current line
  • Ctrl + Space = Autocomplete using IntelliSense
  • Alt + Shift + arrow keys(←,↑,↓,→) = Select custom part of the code
  • Ctrl + } = Match curly braces, brackets
  • Ctrl + Shift + } = Select text between matched braces, brackets
  • Ctrl + Shift + S = Saves all files and projects
  • Ctrl + K, Ctrl + C = Comments the selected lines
  • Ctrl + K, Ctrl + U = Uncomments the selected lines
  • Ctrl + K, Ctrl + D = Do proper alignment of all the code
  • Shift + End = Select the entire line from start to end
  • Shift + Home = Select the entire line from end to start
  • Ctrl + Delete = Deletes the word to the right of the cursor

Navigation Related Keyboard Shortcuts

  • Ctrl + Up/Down = Scrolls the window without moving the cursor
  • Ctrl + – = Take cursor to its previous location
  • Ctrl + + = Take cursor to its next location
  • F12 = Go to definition

Debugging Related Keyboard Shortcuts

  • Ctrl + Alt + P = Attach to process
  • F10 = Debug step over
  • F5 = Start debugging
  • Shift + F5 = Stop debugging
  • Ctrl + Alt + Q = Add quick watch
  • F9 = Set or remove a breakpoint

Search Related Keyboard Shortcuts

  • Ctrl + K Ctrl + K = Bookmark the current line
  • Ctrl + K Ctrl + N = Navigates to next bookmark
  • Ctrl + . = If you type in a class name like Collection<string> and do not have the proper namespace import, then this shortcut combination will automatically insert the import
  • Ctrl + Shift + F = Find in Files
  • Shift + F12 = Find all references
  • Ctrl + F = Displays the Find Dialog
  • Ctrl + H = Displays the Replace Dialog
  • Ctrl + G = Jumps to the line number or go to the line
  • Ctrl + Shift + F = Find the references of the selected item in the entire solution Difference between Website and Web Application

Generally whenever we are trying to create new web project in visual studio we will found two options ASP.NET Web Application and Web Site. What is the difference between these two which one we need to select to create project in

It’s choice of the people can go for web application or website we cannot say that which one is better because both is having advantages and disadvantages. Check below details for web aplication and website.

Web Application

  • If we create any class files / functions those will be placed anywhere in the applications folder structure and it is precomplied into one single DLL.
  • In web application we have chance of select only one programming language during creation of project either C# or VB.NET.
  • Whenever we create Web Application those will automatically create project files (.csproj or .vbproj).
  • We need to pre-compile the site before deployment.
  • If we want to deploy web application project we need to deploy only .aspx pages there is no need to deploy code behind files because the pre-compiled dll will contains these details.
  • If we make small change in one page we need to re-compile the entire sites.
  • By default explicit namespaces are not added to pages, controls or classes, but you can add them manually.


  • If we create any class files/functions those will be placed in ASP.NET folder (App_Code folder) and it’s compiled into several DLLs (assemblies) at runtime.
  • In website we can create pages in multi programming languages that means we can create one page code in C# and another page code in
  • Web Sites won’t create any .csproj/.vbproj files in project
  • No need to recompile the site before deployment.
  • We need to deploy both .aspx file and code behind file.
  • If we make any code changes those files only will upload there is no need to re-compile entire site
  • By default explicit namespaces are added to pages, controls and classes

when you want to create an Informational project, then go for Website and when you want to create an Interactive project that requires programmatic user input or data processing, and then go for Web Application.

Could not load file or assembly ‘CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304’ or one of its dependencies

In this post I will explain how to solve problem of “Could not load file or assembly “CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken= 692fbea5521e1304′ or one of its dependencies. The system cannot find the file specified.” during deploy crystal reports in servers.

Generally we will get this problem because of missing crystal report runtime component in server. To solve this problem we need to install CRRedist2008_x86.msi(32 bit) or CRRedist2008_x64.msi(64 bit) based on configuration of client server. We can get it from our development machine location for that path will be here

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5


we can get it from here

Crystal Reports Basic for Visual Studio 2008 x86(32 bit)

Crystal Reports Basic for Visual Studio 2008 x64(64 bit)

After install run time component reset your IIS or restart your server and try your application it will work for you.


this post shows how we can get PC motherboard serial number. This information can be very useful when we need to create some protection for our software product and other things.

One important thing is that we have to add reference to System.Management DLL file.

To add reference System.Management DLL

Right Click on Project -> Add Reference -> Select System.Management DLL under -> Click OK

Add Name space

using System.Management;

Add Below Code to an Event

private void MDIfrm_Load(object sender, EventArgs e)

   ManagementObjectSearcher MOS = new ManagementObjectSearcher("Select * From Win32_BaseBoard");
   foreach (ManagementObject getserial in MOS.Get())
       label1.Text = "Your motherboard serial is : " + getserial["SerialNumber"].ToString();



Validating a textbox to allow only numeric values in c# windows application


public Form1()

    txtHomePhone.KeyPress += new KeyPressEventHandler(txtHomePhone_KeyPress);
private void txtHomePhone_KeyPress(object sender, KeyPressEventArgs e)
    if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == '') //The  character represents a backspace
        e.Handled = false; //Do not reject the input
        e.Handled = true; //Reject the input