---
title: "TextBox Control in VB.Net"  
description: "The TextBox control accepts input from the user. It can also be used to display text. By default we can enter up to 2048 characters in a TextBox but i"  
author: "Pushpendra Singh"  
published: 2010-12-13  
updated: 2019-12-14  
canonical: https://www.mindstick.com/articles/320/textbox-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# TextBox Control in VB.Net

The [TextBox control](https://www.mindstick.com/forum/155820/how-to-generate-textbox-control-using-htmlhelper-in-razor-view) accepts [input from the user](https://www.mindstick.com/forum/158952/what-are-the-different-methods-for-reading-input-from-the-user-in-python). It can also be used to [display text](https://www.mindstick.com/forum/12715/how-to-display-text-in-an-mvc-view-with-htmlattrbutes). By default we can enter up to 2048 [characters](https://answers.mindstick.com/qa/42112/who-is-the-originator-of-avengers-characters) in a TextBox but if the Multiline [property](https://www.mindstick.com/articles/198559/an-ownership-of-property-in-hua-hin) is set to True we can enter up to 32KB of text.\

## How to use TextBox control

[Drag and drop](https://www.mindstick.com/forum/454/how-to-drag-and-drop-multiple-image-from-one-canvas-to-onther-canvas-in-html5) TextBox control from toolbox on the windowForm.

![TextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/d29b56d7-7fea-4b8f-9b04-427e493c3105/images/2de596ca-1f39-4ff5-bab7-731f567e6398.png)

Add text In TextBox

**Code:**

```
  Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        'Hello text will show in textbox         TextBox1.Text = "Hello" End Sub
```

\

![TextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/d29b56d7-7fea-4b8f-9b04-427e493c3105/images/574ecf9d-6e25-474a-bbc7-2b4d2fbdfbbe.png)

## TextChanged Event of TextBox\
Code:

```
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e  As System.EventArgs) Handles TextBox1.TextChanged         'entered value will show in Label2         Label2.Text = "Price is " + TextBox1.Text + " Rs." End Sub
```

\

![TextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/d29b56d7-7fea-4b8f-9b04-427e493c3105/images/05cc3dbc-c847-4eac-97f8-0838135b87ce.png)

When enter the value in TextBox then TextChanged event will fire and entered value will show in Label.

![TextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/d29b56d7-7fea-4b8f-9b04-427e493c3105/images/c65271b8-5438-4a0a-9bb5-1b120ef4a014.png)

**Textbox [Properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule)**

**ReadOnly:** Makes this TextBox readonly. It doesn't allow to enter any text.

**Scrollbars:** Allows to add a scrollbar to a Textbox. Very useful when the TextBox is multiline.

**Multiline:** Setting this property to True makes the TextBox multiline which allows to accept [multiple lines](https://www.mindstick.com/forum/161317/how-can-you-read-multiple-lines-of-input-in-python-efficiently) of text. [Default value](https://www.mindstick.com/forum/23023/default-value-when-using-singleordefault) is False.

```
Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load               'makes TextBox MultiLine         TextBox1.Multiline = TrueEnd Sub
```

\

![TextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/d29b56d7-7fea-4b8f-9b04-427e493c3105/images/61a7f152-748a-418b-920e-2f2b38be28c3.png)

Text is written in Multiline.

---

Original Source: https://www.mindstick.com/articles/320/textbox-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
