Skip to content

How to Make a button to Accept keyboard "Enter" Press

Behrouz Hosseini

Asked Jun 18, 2010, 11:52 AM EDT1 answer
Share
LinkedInX

 Hi Guys,

Could you please let me know how to make a button (like Add to listbox button) to accept keyboard "Enter" press?

I tried to use:

btnAdd.Selected();

In the Form load events but In this case , the txtInput will lose it's select property and when I click inside the textbox to enter a value the btnAdd also will be unselected!

should I change any thing in btnAdd properties or events?

Regards

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Ok Guys,
    I find the answer, It may be helpful to know that
    the Form has a property called "AcceptButton". just set it to your any button which you want. here I set it to "btnAdd"
    0