views:

189

answers:

3

In Visual Studio, is there a quick way to search for an object's usage in the code behind? This is something I do constantly and the way I am currently doing it seems a little clunky.

I am using VS2005, WinForms, VB and CodeRush/RefactorPro.

Currently I do the following steps: In Design View

  1. Click the Object.
  2. In the Properties Dialog, double click the Name of the object
  3. Copy it to the clipboard (Using Ctrl-C or Right Click and selecting Copy)
  4. Press F7 to bring up the code behind editor
  5. Press Ctrl-Home to position to the top of the file.
  6. Press Ctrl-F, which brings up the Find Dialog
  7. Press Ctrl-V, to paste in the name of the object into the "Find what:" text box.
  8. Tap ENTER to start the Find.

Ideally, I would like to click the object in Design View then hit a hot key to do these other steps.

If VS2005 does not have anything built in, should I research using a Macro?

+1  A: 

If 3rd party addons are allowed, install R# and use the Find Usages tool. Although not sure R# would be worth it just for this feature alone.

mxmissile
+1  A: 

I don't know about any functionality like that, built-in visual studio, however, you can use the wonderful plugin Resharper from JetBrains which has that functionality, as many other excellent features...

There is also another add-on called CodeRush, I haven't used it but it seems to be worth a look.

Jhonny D. Cano -Leftware-
I am using CodeRush. Does anyone know if it has this feature?
Gerhard Weiss
Do you know the name resharper gives this functionality? How is it invoked? (i.e. what key sequence, mouse clicks is need to run it.)
Gerhard Weiss
Right click on your class or object and select Find Usages.
mxmissile
Or with ALT+f7 or CTRL+Alt+F7
Jhonny D. Cano -Leftware-
Search for the White Paper for ReSharper JetBrains, I don't remember where i get it, but is very useful, I have it in front of my desk
Jhonny D. Cano -Leftware-
+1  A: 

Tab To Next Reference - CodeRush Or CodeRush Xpress

This feature allows you to cycle through all references to an identifier simply by placing your caret within the identifier and hitting [TAB]

Find All References - CodeRush

The use of the [Shift-F12] combo in CodeRush will bring up the References toolwindow which will then display all references to the identifier currently at the caret.

Rory Becker