c# - Multiple TextChanged and KeyPress event -


i have lot of textbox controls. every textbox control text_changed , key_press events. because of form.cs becomes crowded. question this, possible make more space free? events consist of 1 function.

sample code:

private void txtitem_textchanged(object sender, eventargs e) {     showbuttonsave(); }  private void txtitem_keypress(object sender, keypresseventargs e) {     showbuttonsave();     char ch = e.keychar;     if (ch == (char)keys.enter)     e.handled = true; }  private void txtitem2_textchanged(object sender, eventargs e) {     showbuttonsave(); }  private void txtitem2_keypress(object sender, keypresseventargs e) {     showbuttonsave();     char ch = e.keychar;     if (ch == (char)keys.enter)     e.handled = true;  } 

on txtitem2 can go properties , there says ontextchange should see set txtitem2_keypress change txtitem_keypress both use

private void txtitem_keypress(object sender, keypresseventargs e) {   showbuttonsave();   char ch = e.keychar;   if (ch == (char)keys.enter)   e.handled = true; } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -