Visual Basic - Locate A Variable In Your Project With The Definition Menu Option (VB IDE/Visual Studio .NET)

Have you ever been debugging an application and came across an unfamiliar variable? Well, you can easily find out where you declared the variable by using the Definition menu option. To use this option:

  • Select a variable in your code and right-click on it
  • Select Definition from the shortcut menu
  • VB will jump to the area in your code where you declared the variable
  • To return to the line in your code where you selected the variable, right-click in the declaration area and select Last Position from the shortcut menu
  • If VB can't find the variable, it will display an error: Identifier under cursor is not recognized.

You can also use this technique in Visual Studio .NET. However, it doesn't offer the Last Position menu option to help you get back to the spot you left and it won't display an error if the variable declaration doesn't exist.

Go back