Tip #86: Did you know… Visual Studio has several different search options?

The standard methods for searching can be found under the Edit --> Find and Replace menu.

EditFindReplaceMenu

The “Quick Find” method (Ctrl+F) allows users to search inside of the current document, all open documents, the current project, the entire solution, and the current block by changing the Look in selection.

 

QuickFindLookIn

If you set Look in to be the current project or the entire solution, Visual studio will open files that have matches as you navigate between matches.

You can also adjust the settings under Find options to make the searches more specific by having them match on case or whole words or control how it searches by deciding whether it should search up or down or if it should look at hidden text (collapsed regions).

QuickFindFindOption

The Find in Files method (Ctrl+Shift+F) allows users to see all the occurrences of the search in one place, changes the Look in options by removing the current block, but allows users to search custom locations by using the “…” button next to the Look in drop down, and allows the user to restrict the types of files searched.

FindInFiles

If you use Ctrl+F or select the Quick Find option from the find and replace menu by mistake, hitting Ctrl+Shift+F or selecting the drop down in the upper left corner of the dialog and selecting Find In Files will quickly get you to the Find in Files dialog.

Using the Result options section you choose to have the results displayed in either the “Find Results 1” or “Find results 2” window. Allowing you to switch between results if needed.

The Find What field also keeps a history of searches. To access this history click the down arrow of the Find What field. You can avoid using the history or typing search terms by having the value you want to search for selected in the editor before opening one of the find dialogs.

Ben Byrd
SDET | Visual Web Developer

Comments

  • Anonymous
    June 30, 2009
    Great info, thanks. Does VS utilitize Windows Searh, Desktop Search or Indexing Service for any of these searches? If not by default, is there any way this can be enabled? I tend to disable all background indexing on my dev machines, but Find in Files feels slower on my latest dev machine when Windows Search is disabled, and I wonder why.

  • Anonymous
    July 01, 2009
    Hi, This is a very nice article. Thanks for letting us know these details. Thanks, Thani