/// <summary> /// Sets the maximum length. /// </summary> /// <param name="textBoxBase">The text box base.</param> /// <param name="value">The value.</param> public static void SetMaxLength(this TextBoxBase textBoxBase, int value) { if (textBoxBase.InvokeRequired) { textBoxBase.BeginInvoke(new MethodInvoker(() => textBoxBase.SetMaxLength(value))); } else { textBoxBase.MaxLength = value; textBoxBase.Refresh(); } }