We help IT Professionals succeed at work.

Is there any equivalent Forms AcceptButton in the .Net Compact Framework?

mromeo
mromeo asked
on
Medium Priority
1,189 Views
Last Modified: 2008-02-01
Hi. I know you can set the AcceptButton in the .Net Framework to let a button be processed when the user hits "Enter."  The compact framework does not have this property on its Form class.  How can the compact framework do the equivalent of the AcceptButton?  Thanks.
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
Something like this:

  protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
  {
    if (e.KeyCode == Keys.Enter)
    {
      button1_Click(this.button1, EventArgs.Empty);
    }
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
     MessageBox.Show("Hello");
   }

Bob

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I kinda figured I'd have to do something like this.  Ok, thanks for the help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.