Quick Search, Replace and Navigate in Visual Studio IDE (A Must Read Post)

I would call this article a Tips & Tricks article because this article contains information about Visual Studio IDE features. I can see that many developers are not familiar with these features. So, I thought of writing an article collecting searching, replacing and navigating tips which is vital to being happy and productive.


Navigate To (Ctrl+,)


This feature provides search-as-you-type support for files, types, and members to match the input string. You can find this feature under the "Edit" menu or use the keyboard shortcut "Ctrl + ," (Ctrl+Comma) to bring up the "Navigate To" dialog box. The following is a screen of the "Navigate To" dialog.



You just need to double-click on any search result to navigate to that page.


Quick Launch (Ctrl+Q)


Quick Launch is used to quickly search and execute actions for IDE assets such as options, templates and menus. You can't use Quick Launch to search for code and symbols. The Navigate To dialog box works fine for this (as given above). The Quick Launch search box is located at the top-right corner of the menu bar and is accessible by pressing Ctrl+Q. Simply enter your search string in the box.


For example, I would like to search for database designer settings, I will type "database designer" in the Quick Launch box.



Now, just click on the search result to bring the database designer setting dialog up.


Incremental Search (Ctrl+i)


Incremental Search is a great tool that allows searching within the current document, and enables you to do so without having to bring up a dialog. Just press "Ctrl+i" on any page and start typing, it will start highlighting the matching. After typing the key, start pressing Ctrl+i to navigate forward through highlighted items and start pressing "Ctrl+Shift+i" to navigate backward through the highlighted items.



Find and Replace (Ctrl+Shift+F and Ctrl+F)


Find and Replace are the ones most developers are familiar with. Ctrl+Shift+F brings up a dialog allowing you to search and replace things whereas Ctrl+F only allows searching.


When I pressed Ctrl+Shift+F I got the following screen. Here, you will have the option to select the range for searching (look in). You can replace things, you can bookmark things etc.



When I pressed Ctrl+F I got the following screen. Here, you have the option to select the range for searching.



Find Usages (Shift + F12)


In the Visual Studio IDE, when we press F12 to "go to definition" it takes us to where it (whatever is where the cursor is at) is defined, and that is very useful. But what if I want to see everywhere something is used and what the files are then that can be done using "Find Usages". To use it, simply select or move the cursor onto a method/type and press "Shift+F12".


For example, to see how many times a method GetDistrict() is used and what the files are I just moved the cursor on the method and pressed Shift+F12 and boom, you will see the search result at the bottom.



Navigate Backward/Forward (Ctrl + Minus and Shift + Ctrl + Minus)


This is another useful thing you should know. Have you ever navigated to a different code file, looked at something, and then wanted to navigate back to where you came from?  For example, you use F12 to "go to definition" and then want to return back to the code that used it or back and forth? For this you need backward/forward navigation.


So, press Ctrl+Minus to navigate backward and press Shift+Ctrl+Minus to navigate forward.


Hope this helps.


Similar Articles