How to format all textbox values on LostFocus event in Winform
问题 I need to add commas to thousand position of every numerical value in any related text-box value upon lost-focus event. I have created the following function: public static void FormatNumerical(this Control control) { if (!(control is TextBox) || !control.Text.IsNumeric()) return; control.Text = String.Format("{0:n}", control.Text); } Is there a way to apply this method to all lost focus events for all my textboxes in my winform application in one shot? 回答1: Is that you need? ProcessTextBoxes