CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Default Button

  1. #1
    Join Date
    Sep 2006
    Posts
    392

    Default Button

    Dear All,
    How to invoke a button click event when pressing the Enterkey in any of the controls in a Form
    VS 2005

  2. #2

    Re: Default Button

    David Domingues at [email protected]. Feel free to visit http://www.webrickco.com

  3. #3
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: Default Button

    A word of advice: Create a form and place a button on it. Go to the Properties for the form and read the names and descriptions of all of the properties. Then, select the button and read the names and descriptions of all of the properties. I believe that once you do this, you will have a much better understanding of how things work. It will also answer your question.

  4. #4

    Re: Default Button

    Then enlight us!!!!
    Arrogant attitude leads nowhere...
    David Domingues at [email protected]. Feel free to visit http://www.webrickco.com

  5. #5
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: Default Button

    I'm not being arrogant, and I apologize if you took it that way.

    If you look at the properties of a Form, you'll find a section called "Misc". Under that section, there are two properties called "AcceptButton" and "CancelButton". If you select "AcceptButton", the description at the bottom says "The accept button of the form. If this is set, the button is 'clicked' whenever the user presses the 'ENTER' key. Similarly, the "CancelButton" description says that the button is associated with the "ESC" key.

    The point of what I said was that you can find out a lot of things by examining the properties of the controls you are using. I often find out things that I would never have known this way. For example, there's the DialogResult property on a button that makes it so you can create custom user prompt dialogs without having to write any form code. I would never have known about this if I hadn't taken a close look at the Button properties.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured