Search code examples
.netvisual-studiowindows-forms-designer

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?


Solution

  • 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).