TextBox Control in ASP.NET
TextBox Control is used for user to enter the input like any string eg., Name, Password , number etc., Asp.NET TextBox itself is a class which is present under System.Web.UI.WebControls namespace. It is used to accept SingleLine, MultiLine or Password characters as the input.
Syntax Of Textbox
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Properties
Properties |
Discription |
AutoCompleteType |
Specifies the AutoComplete behavior of a TextBox |
AutoPostBack |
A Boolean value that specifies whether the control is automatically posted back to the server when the contents change or not. Default is false |
CausesValidation |
Specifies if a page is validated when a Postback occurs. |
Columns |
The width of the textbox. |
MaxLength |
The maximum number of characters allowed in the textbox. |
ReadOnly |
Specifies whether or not the text in the text box can be changed. |
Rows |
The height of the textbox (only used if TextMode="Multiline"). |
runat |
Specifies that the control is a server control. Must be set to "server". |
TagKey |
|
Text |
The contents of the textbox. |
TextMode |
Specifies the behavior mode of a TextBox control (SingleLine, MultiLine or Password). |
ValidationGroup |
The group of controls that is validated when a Postback occurs. |
Wrap |
A Boolean value that indicates whether the contents of the textbox should wrap or not. |
OnTextChanged |
The name of the function to be executed when the text in the textbox has changed. |
.vb CODE
Protected Sub Button1_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("Name:" + TextBox3.Text)
ListBox1.Items.Add("father Name:" + TextBox4.Text)
ListBox1.Items.Add("Course:" + TextBox5.Text)
ListBox1.Items.Add("college:" + TextBox6.Text)
End Sub
Output: