Eric
Eric

Reputation: 6425

How can I find a button by name in designer?

I'm working with a legacy VB.NET, Windows Forms application in Visual Studio that has dialogs with several buttons.

I can't find the specific button I'm looking for on the designer canvas.

Is there a shortcut that lets you search for a button on the designer canvas by name?

Upvotes: 3

Views: 4157

Answers (3)

Simon Borg
Simon Borg

Reputation: 31

Since personally I didn't understand what people were talking about at first,

Here's a quick gif of what to do:

https://i.sstatic.net/HnfvN.gif

Upvotes: -1

KyleMit
KyleMit

Reputation: 29889

Use Document Outline which will show you every object on the Form and automatically locate it wherever it is.

  1. Go to View > Other Windows > Document Outline or Ctrl + Alt + T

    Document Outline

  2. Navigate the Tree and find the Object you want

    Navigate Tree

Upvotes: 0

J0e3gan
J0e3gan

Reputation: 8938

First Thought

You can use Visual Studio's Properties Window in design view to choose controls on the form by name:

Visual Studio's Properties Window in Design View

If your Properties Window is not displayed already, you can open it through the View menu (View > Properties Window) or by pressing F4. The above screenshot is from VS 2013; but the Properties Window has been in VS for many versions.

Afterthought

You can also tab through controls in design view by selecting one

Tabbing Through WinForms Controls in Visual Studio's Design View 01

then pressing Tab to shift focus to the next one

Tabbing Through WinForms Controls in Visual Studio's Design View 02

and pressing it again to advance to the next one

Tabbing Through WinForms Controls in Visual Studio's Design View

etcetera.

This is not a shortcut to locate a control on the design canvas by name per se; but it is handy for the situation you describe; and you will notice that the current-control name in the Properties Window changes with the shift in focus each time you press Tab (which does more specifically fit your desire to find a control by name).

Upvotes: 3

Related Questions