- TextBox Control is used to display text and accept input from the user.
- One can enter maximum of 2048 characters in TextBox Control.
- TextBoxes can be single line or multiline, can have scroll bars or can be read only.
- You can place a TextBox control on the form by drag and drop it from the toolbox. The TextBox control looks like as follows:
Properties of TextBox Control
Some of the commonly used properties of TextBox Control are listed below in the Table:
Methods of TextBox Control
Some of the commonly used methods of TextBox Control are listed below in the Table:
Events of TextBox Control
Some of the commonly used Events of TextBox Control are listed below in the Table:
Here is a simple example of TextBox control. To understand the use of the TextBox control follows the given steps:
- Add two Label controls to the Form by drag and drop them from the Toolbox.
- Now change the Text property of the Label1 control to “UserId” and Label2 control to “Password.
- Now place one TextBox control besides the Label UserId from the toolbox.
- Now place one more TextBox control besides the Label Password from the toolbox.
- Now set the PasswordChar Property of the TextBox2 as ‘*’.
- Now run the application using F5 key. This will produce the given Form at run time type any user id and password in the text-boxes: