Computer Programming

Computer Programming » A Generic Computer Program » Adding a Textbox

Adding a Text Box

Pay attention to the toolbox. It contains all the elements that you will want to add to your form. To add an element, be sure the form is selected and then double-click on the item to be added.


Select the Textbox tool, and double-click on it. It will add it to your form that has been selected. When you use the double-click approach it will place the element on the form, though likely not where you want it to be.


A text box will show up on the window, in the upper left corner of the form. The text box will have the little white squares on either end, a visual cue that says it has been selected.


Now the properties window will change since the textbox is selected.


You can use the mouse or cursor keys to move the text box once the text box has been selected. To use the cursor keys, press the key associated with the direction you wish to move the text box. To use the mouse, hover over the text box until the cursor looks like a plus sign with arrow heads at the end of each line. Be careful not to hover over the white squares, as that would expand or contract the size of the text box.


In the properties, the Text property is blank, as there is no text in the textbox. The text property is the same property name as used for the form window, but has a different result. The text property for the text box will add the text entered into the text box.


Add something to the value of the textbox text property. In this example, we will add Hello as the text value in the properties.


Notice the text inside the textbox changes as we change the text value in the properties window.


When you run the program, the text is displayed. The text is displayed inside of a text box shown on the form. There are many properties that are default, such as the text being left justified. These can be changed by modifying property values of the text box.


As a user, I can type in that text box and change it to Hello World. This is because by default, the text box is editable, meaning that a user can edit the contents in the text box. We can change that by modifying the properties of the text box.


⇐ Prev Chapter
Changing the title of the textbox

Next Chapter ⇒
Adjusting the properties of the textbox

Computer Programming for Everyday People
Michael Bigrigg

Amazon eBook

Powered by w3.css