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
Post a Comment