Search code examples
c#.netwinformsuser-controlsacceptbutton

.NET UserControl accept button best practice?


I have a windows forms app where I have split different functionality into several user controls. I want each of these user controls to have an accept button.

Any best practices here?

My idèa is to detect which user control that has focus, and than set it in the parent Form.

Any other idèas?


Solution

  • Jan Miksovsky has an excellent blog on UI design, and wrote an article about this very thing.

    Most UI platforms allow a designer to indicate which button in a dialog should be the default button: the button that will be pressed if the user types the Enter key. The default button is generally the button the user is most likely to press next, often a button like OK that closes the dialog. In very high-traffic dialogs, you may want to consider dynamically changing the default button to save keystrokes and help speed the user's task.

    The example he uses is the "Select Names" dialog in Microsoft Outlook, which changes the default button depending on what you are doing.