Microsoft KB Archive/884465

= You receive a &quot;Total occurrences found: 0&quot; message when you use the Find in Files dialog box in Visual Studio .NET or Visual Studio 2005 =

Article ID: 884465

Article Last Modified on 11/14/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





SYMPTOMS
In Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005, when you perform a search by using the Find in Files dialog box, you notice that the search process returns no occurrences of your search phrase in the current document. The report in the Find Results window appears similar to the following:

Find all &quot; &quot;, Hidden, Block, Find Results 1, Current Document

Total occurrences found: 0

Note  is a placeholder for the phrase that you are trying to locate in the document.



CAUSE
This behavior occurs because the Find dialog box uses block scope. The scope that is set in the Find dialog box also applies to the Find in Files dialog box.



WORKAROUND
To avoid this behavior, set the scope in the Find dialog box to Current document. To do this, follow these steps:  Start Visual Studio .NET or Visual Studio 2005. Create a Visual C# Windows Application project. Open the code view of the Form1.cs form.  Position the pointer on the following function. This function is located inside the Form1 function. InitializeComponent  On the Edit menu, point to Find and Replace, and then click Find. The Find dialog box appears. Under Search, select Current document.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to reproduce the behavior
<ol> Start Visual Studio .NET or Visual Studio 2005.</li> Create a Visual C# Windows Application project.</li> Open the code view of the Form1.cs form.</li>  Position the pointer on the following function. This function is located inside the Form1 function. InitializeComponent </li> Perform a search by using the Find in Files dialog box. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> On the Edit menu, point to Find and Replace, and then click Find in Files. The Find in Files dialog box appears.</li> In the Find what box, type Dispose .</li> In the Look in box, select Current Document.</li> Click Find.</li></ol>

The search occurrences appear in the Find Results window.</li> Perform the same search by using the Find dialog box. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> On the Edit menu, point to Find and Replace, and then click Find. The Find dialog box appears.</li> In the Find what box, type Dispose .</li> Under Search, select Only:Form1.</li> Click Find Next.</li></ol>

You receive the following message:

The specified text was not found.

</li> Repeat step 5.

You notice the behavior that is mentioned in the &quot;Symptoms&quot; section.</li></ol>

<div class="references_section">