Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I alter the height of a TextBox control in the windows forms design view?

Tags:

I have a new project. I drop a textbox control on it. I open up the properties window, and I can change the height and hit enter or click out of the box and it will update the designer, but when I try to change the height it resets back to the default value. Why is that? I had the same issue with a Label, but I turned off AutoSize and it allowed me to modify the values. Is there some property I can turn off to be able to modify the Height of a textbox in the design view? I'm using Visual Studio 2010 sp1. I had the same issue in Visual Studio 2008. I am new to Windows forms.

like image 338
awright18 Avatar asked Jan 04 '12 03:01

awright18


People also ask

How do you adjust the height of a TextBox?

To resize a shape, text box, or WordArt, under Drawing Tools, on the Format tab, in the Size group, enter the measurements that you want into the Height and Width boxes.

How do I resize a form in Visual Studio?

By dragging either the right edge, bottom edge, or the corner, you can resize the form. The second way you can resize the form while the designer is open, is through the properties pane. Select the form, then find the Properties pane in Visual Studio. Scroll down to size and expand it.


2 Answers

You need to set TextBox.Multiline property as true .

TextBox1.Multiline = true; 
like image 87
KV Prajapati Avatar answered Oct 23 '22 18:10

KV Prajapati


Checking Multiline will allow to resize but it also allows enter(return) key in the textbox.
The Height of a non-Multiline TextBox is fixed by the size of the Font.
Reduce to textbox Font size, the TextBox will resize automatically.

like image 38
bonny Avatar answered Oct 23 '22 19:10

bonny