Here, the HorizontalAlignment is used to represent the HorizontalAlignment enumeration values that specify how text is aligned in the TextBox control.
In this method, you can set the TextAlign property of the TextBox programmatically with the help of given syntax: public TextAlign Run-Time: It is a little bit trickier than the above method.
How to center text in word textbox windows#
You can place TextBox anywhere on the windows form according to your need. Step 2: Drag the TextBox control from the ToolBox and drop it on the windows form.Visual Studio -> File -> New -> Project -> WindowsFormApp Design-Time: It is the simplest way to set the TextAlign property of the TextBox as shown in the following steps: In Windows form, you can set this property in two different ways:ġ. The default value of this property is HorizontalAlignment Left. In TextBox, you are allowed to set the alignment of the text present in the TextBox by using the TextAlign Property of the TextBox. With the help of TextBox, the user can enter data in the application, it can be of a single line or of multiple lines. In Windows forms, TextBox plays an important role. ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.