c# - Making a button click when pressing enter instead of clicking the control -
i'm trying make button called btnsubmit submit customer's information if hit enter on keyboard. know in vs2012 if i'm coding strictly c#, can change properties , set button activated when enter pressed.
because coding in .net c#, not have option control. advice coding? can't find anything.
i working web form.
i think trick.
don't attempt trigger button click. should refactor code event handlers separated actual implementation. e.g.
void form_keydown(object sender, keyeventargs e) { if (e.keycode == keys.enter) { checkanswer(); } } public void button1_click(object sender, eventargs e) { checkanswer(); } private void checkanswer() { // stuffs on button click }
Comments
Post a Comment