Search code examples
c#winforms.net-3.5textbox

Change the Textbox height?


How do I change the height of a textbox ?

Neither of the below work:

this.TextBox1.Size = new System.Drawing.Size(173, 100);

or

this.TextBox1.Size.Height = 100;

I wanted to be able to change the single line text box height to fit a font size on it without using multi-line if possible.


Solution

  • There are two ways to do this :

    • Set the textbox's "multiline" property to true, in this case you don't want to do it so;
    • Set a bigger font size to the textbox

    I believe it is the only ways to do it; the bigger font size should automatically fit with the textbox