Form and Enter

  • Thread starter Thread starter Hsg
  • Start date Start date
H

Hsg

Hi all..

in C# , and specally in Forms ...
i had creat a form , the user enter Inputs , and then
press the Button ...

is there a way that the user will have teh choice to
press the Button on the form , or just simply Press the
Enter Button in his Key Bord ..?

thanks ..
 
Set the AcceptButton property on the form to the button you want to use when
the user presses Enter; there is also a CancelButton property for the ESC
key.
 
Thank you Mr. Steven for your replay ...
but can you show me a simple sample code ...

becouze i wont to give the user teh choice either to
press the Form button , or press the Keyboed "Enter Key"
 
No code is required.

Create a new form, put a button on it called button1. Click on the form in
the designer and press F4 to bring up the properties. The AcceptButton
property will display a drop down list; simply select button1 from the list.
Now, when the app runs the user can click on button1 using the mouse or
press the Enter key. Either of these actions will fire the button1_click
event.
 
Back
Top