Accessing a Control Without Being Able to See It on a Windows Form

Accessing a Control Without Being Able to See It on a Windows Form

Menu Key Displayed on KeyboardA coworker of mine had a problem and came to me for help. She had a windows form with a control on it that she wanted to edit or delete, but couldn’t see the control. It was listed in the properties box in the list of controls on the form, but when she selected it, she wasn’t able to click it on the form, because it was behind another control.

I hypothesized a solution, which worked, but requires the use of a less than frequent key on your keyboard, the menu key. Usually this key is two keys to the right of the space bar on windows keyboards, between Alt and Control. A picture of it is on the right.

Note: As pointed out by Lee, in the comments, you can press Shift + F10 if your keyboard doesn’t contain the Menu Key.

The Form With a Hidden Label Behind the Filename TextBox) Form with hidden label control

Properties Window Listing the Hidden Control, HiddenLabel

Properties window list of controls

Select the control that you can’t see. It will be highlighted on the form.

Form with Hidden Control Highlighted

Label highlighted after selecting from properties windowThe hidden control becomes highlighted. Click into the title bar of the form. Press the menu key on your keyboard to display the context menu.

Context Menu Being Displayed After Pressing the Menu Key

bringtofrontSelect “Bring to Front” to display the control. It will now be visible and can be edited or removed.

Hidden Control Moved

Label after being brought to front and movedAs you can see, the control that was previously hidden is now visible and has been moved.

I know this is a basic solution to an easy problem, but I had to figure it out, and I hope that someone searching may find this useful as well. The above example was a new form I was starting; it is not the actual application in question.

Author: Chris Benard

Chris Benard is a software developer in the Dallas area specializing in payments processing, medical claims processing, and Windows/Web services.

Comments