You can do this in your form:
private void RefreshHeight(TextBox textbox) { textbox.Multiline = true; Size s = TextRenderer.MeasureText(textbox.Text, textbox.Font, Size.Empty, TextFormatFlags.TextBoxControl); textbox.MinimumSize = new Size(0, s.Height + 1); textbox.Multiline = false; }
Then you say RefreshHeight(textbox1);
Multiline change will force the text box to "accept" a new size
source share