VB.NET TextBox Control
A TextBox control is used to display, accept the text from the user as an input, or a single line of text on a VB.NET Windows form at runtime. Furthermore, we can add multiple text and scroll bars in textbox control. However, we can set the text on the textbox that displays on the form.
Let's create a TextBox control in the VB.NET Windows form by using the following steps:
Step 1: We have to drag the TextBox control from the Toolbox and drop it on the Windows form, as shown below.
Step 2: Once the TextBox is added to the form, we can set various properties of the TextBox by clicking on the TextBox control.
VB.NET TextBox Properties
There are following properties of the TextBox control.
||It is used to get or set a value that indicates how the automatic completion works for the textbox control.
||It is used to set the font style of the text displayed on a Windows form.
||It is used to set the number of lines in a TextBox control.
||It is used to get or set a value representing whether the TextBox control can modify the character's case as they typed.
||It is used to enter more than one line in a TextBox control, by changing the Multiline property value from False to True.
||It is used to get or set a value that indicates whether pressing the enter button in a multiline textbox; it creates a new line of text in control.
||It is used to set the password character that can be a mask in a single line of a TextBox control.
||It is used to set the preferred height of the textbox control in the window form.
||It is used to display a scrollbar on a multiline textbox by setting a value for a Textbox control.
||It is used to get or set the text associated with the textbox control.
||The Visible property sets a value that indicates whether the textbox should be displayed on a Windows Form.
||The WordWrap properties validate whether the multiline Textbox control automatically wraps words to the beginning of the next line when necessary.
VB.NET TextBox Events
||When a textbox is clicked, a click event is called in the textbox control.
||It occurs in the TextBox Control when the value of CauseValidation property is changed.
||It is found in the TextBox control when the property value of the AcceptTab is changed.
||It is found in the TextBox Control when the property value of the BackColor is changed.
||It is found in the TextBox Control when the value of the BorderStyle is changed.
||It is found when the new control is added to the Control.ControlCollection.
||It is found in TextBox, when the textbox control is removed from the Control.ControlCollection.
||It occurs when the property of the Font is changed.
||It is found in TextBox control to get the focus.
||A MouseClick event occurs when the mouse clicks the control.
||It is found in a textbox control when the value of multiline changes.
Furthermore, we can also refer to the VB.NET Microsoft documentation to get a complete list of TextBox properties and events.
Let's create a program that displays the login details.
Now enter all the details of the User Login form, it shows the following image, as shown below.
Now, click on the Login button. It shows all the details filled by the user in the form.
The Exit button in the form used to terminate the program.