January 5, 2015 by Nitesh

Change Height of TextBox Control in Windows Forms


From the title, this seems to be a very simple post that every novice programmer would know but changing the height of a textbox control in a Windows Forms Application is bit tricky that thought. You must be wondering that setting the Size.Height property of the control would do this, but as soon as you change this, it reverts back to the original default size. If not, go give a try and let me know if it works instantly. In this post, we will see ways on how to achieve this. There are few ways you can increase the height of the textbox. They are –

Option 1: Use MultiLine Property

You can set the MultiLine property of the TextBox control to True and then increase the height of the TextBox. This may not be desirable in some cases when you want to restrict users to enter only single line in the textbox.


Option 2: Change Designer.cs file

Open the Designer.cs file and scroll down to the place where your textbox properties are set. Add the following lines to set the height of the TextBox. However, if you are using this approach, beware that you changes get lost as soon as you make some change in the Form designer and hence this approach is highly recommended to be NOT used.

Option 3: Use MinimumSize Property

This is the most robust way I have found so far. To use this approach, you need to make 2 changes in your Textbox properties.

  1. Set MinimumSize Property of the TextBox to your desired size(Height & Width)
  2. Clear the Size Property of the TextBox to blank and hit Enter.


As you do this, your TextBox will resize to your desired Height & Width.

Hope you like this post! Keep learning and sharing ! Cheers!


Support us!

If you like this site please help and make click on any of these buttons!

Powered by WordPress Popup