If we've learned one thing in the last 10 years it's that we need a quick and intuitive way to search through our stuff. We use Google to find that essential page among the billions of irrelevant pages on the Internet. On my local computer I'm always using search to find documents on my hard drive. For example, today I need to find an architectural document from a project that I worked on two years ago. Without search I'd be relegated...
to hand searching through hundreds of directories to find that one file.
Search in Visual Studio
Visual Studio provides a number of handy search tools. The most obvious place to use search is in your source code but Microsoft has also made search available in other parts of the IDE like the ToolBox and property grid windows.
The ToolBox is a handy place to see all of the available controls for a designer surface. When you open an ASP.net page, WPF window or Windows Form designer the ToolBox shows you filtered selection of controls available for that designer type. Even with the filter applied, there still can be dozens of controls to scroll though. Thus was born the Toolbox search feature.
Search works in the ToolBox, there are no visible clues that you can search however. You need to set focus to the ToolBox and then type the first letters of the desired control.
There is a subtle clue that you have a search active in the ToolBox. Take a look at the status bar at the bottom of the IDE. There is some informational text there including the instruction to 'Press the tab key to find the next result'. In the screenshot you can see I was searching for 'pr'.
Search in PropertyGrid
When Expression Blend was released I was delighted learn that search was built into the Properties Pane. Visual Studio 2008/2010 followed this excellent trend and includes search in the PropertyGrid window. To filter the properties in the PropertyGrid locate the search text box at the top, and type in your search criteria.
Here is an example of the filtered results for a "wid" search string.
Another hidden gem in Visual Studio is the Incremental Search feature (Ctrl-I). This feature is easy to overlook as it is rarely mentioned in documentation. It is dialog-less which is another reason why you may not have seen it before. But not having a dialog is the prime advantage of this search tool.
Pressing Ctrl-I when in a code window, changes the cursor to a binocular icon.
Now, typing "co" moves the incremental search highlight to the 'co' in comment.
This interactive feedback is instantaneous and intuitive. You can quickly change the search. Watch what happens when I append the letter 'd" while still in incremental mode.
All is not perfect with it however. Incremental search doesn't look for text in hidden region. For that you still need a regular search.
I really don't know the official name for this feature, so I made up a name. Here's how to use it.
Select some text in any editor window. Now press Ctrl-F3. Visual Studio will move to the next match of those characters. Continue to press Ctrl-F3 to move to additional matches. The InstaSearch will not navigate to other files within your project; it only searches the current file.
Find In Files
Another favorite of mine, which I often use in place of the regular Ctrl-F search dialog, is the "Find In Files" search. It can search through all the files in your project and it has a powerful set of options. Look for future tip on this site for more details about this feature.