Compartir a través de


Searching and Replacing Code References

You can search for and replace code references and text in your projects and folders in Visual FoxPro.

Searching Projects and Folders for Code References

You can use the Code References tool to locate specific code or text that appears in your projects or folders.

To search for a code reference in a project

  1. To search one or more projects, open the project or projects that you want to search.

  2. From the Tools menu, select Code References.

    If you did not perform a previous search in the project, the Look Up Reference dialog box appears. Otherwise, the Code References window appears and displays the previous search results.

  3. Type the code or text you want to search for in the Look for box.

  4. Make sure Scope is set to Entire project and the name of the project you want to search. To select a different open project, click the Scope arrow to display a list of open projects.

    • To change the scope of your search from a project to a folder, click the Scope arrow and select Folder. You need to specify the folder you want to search in the Look in box.
    • To restrict your search to the project home directory and subfolders, select the Limit search to project home directory and subfolders check box.
    • To specify file types other than the default types in your search, click the File Types arrow to display a list of file types.
    • To specify additional options for your search, select settings from the Options group or click the Options button to open the Options dialog box.
  5. Click Search to begin the search.

The Code References window displays the search string as a code reference node in the search pane and any results from your search in the results pane if successful.

You can view all the results by selecting the code reference node in the search pane, or you can filter your results for each file by selecting a file name in the search pane. You can open the file and go to a code reference directly by double-clicking a result in the results pane.

For more information about the Look Up Reference dialog box and its options, see Look Up Reference Dialog Box and Look Up Reference Dialog Box, Options Dialog Box.

To search for a code reference in a folder

  1. From the Tools menu, select Code References.

    If you did not perform a previous search in the folder, the Look Up Reference dialog box appears. Otherwise, the Code References window appears and displays the previous search results.

  2. Type the code or text you want to search for in the Look for box.

  3. Make sure the Scope box is set to Folder and that the Look in box is set to the folder you want to search.

    • To expand your search to the folder's subfolders, select the Search subfolders check box.
    • To specify file types other than the default types in your search, click the File Types arrow to display a list of file types.
    • To specify additional options for your search, select settings from the Options group or click the Options button to open the Options dialog box.
  4. Click Search to begin the search.

The Code References window displays the search string in the search pane and any results from your search in the results pane if successful.

You can view all the results by selecting the code reference node in the search pane, or you can filter your results for each file by selecting a file name in the search pane. You can open the file and go to a code reference directly by double-clicking a result in the results pane.

For more information about the Look Up Reference dialog box and its options, see Look Up Reference Dialog Box and Look Up Reference Dialog Box, Options Dialog Box.

Replacing Code References

You can use the Code References tool to search for and replace code or text that appears in your projects or folders.

To replace a code reference in a project or folder

  1. Perform a code reference search by using Code References tool to locate the code or text you want to replace.

    If your search is successful, the Code References tool displays the search results in the results pane of the Code References window.

  2. Identify all the lines of code in which you want to replace the code reference or text.

  3. Do one of the following:

    • To specify particular lines of code in which you want replace the code reference or text, select the check box for each line of code you want that appears in the results pane.
    • To specify all lines of code for replacement, right-click in the results pane to display a shortcut menu and choose Select All.
  4. Click Replace on the toolbar in the Code References window to open the Replace dialog box.

    If you select lines of code for replacement in which data files might be affected or where changes to data structures, property values, or property and method names in forms (.scx) or Visual Class libraries (.vcx) might occur, Visual FoxPro prompts you to confirm or decline the replacement operation.

    If you confirm replacement, Visual FoxPro performs only those replacements that do not affect data files and provides code in the search string node under the Replacement Logs node for you to manually perform the desired changes.

    If you decline replacement, no changes are made.

  5. Type the replacement code or text in the Replace with box. Select any additional desired options from the Options group.

  6. Click Replace to begin replacement.

If you selected Confirm replacements from the Options group, you must confirm the replacement operation for each line of code you selected.

After the Code References tool finishes replacing the code or text, you must confirm whether you want to refresh the results in the Code References window.

The Code References window displays a record of the replacement operation as a log node below the Replacement Logs node in the search pane and the results of the replacement in the results pane.

See Also

Creating Programs | Look Up Reference Dialog Box | Code References Window