---
title: "RichTextBox Control in VB.Net"  
description: "The RichTextBox Control in VB.NetThe RichTextBox allows formatting the text. It also provides the facility to save the text in the file and restore"  
author: "John Smith"  
published: 2010-12-13  
updated: 2020-08-04  
canonical: https://www.mindstick.com/articles/315/richtextbox-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# RichTextBox Control in VB.Net

## The RichTextBox Control in VB.Net

The RichTextBox allows formatting the text. It also [provides the facility](https://www.mindstick.com/Articles/326/webbrowser-control-in-vb-dot-net) to save the text in the file and [restore](https://www.mindstick.com/blog/239/how-to-back-up-and-restore-a-mysql-database) it from the file.\

[Drag and drop](https://www.mindstick.com/forum/454/how-to-drag-and-drop-multiple-image-from-one-canvas-to-onther-canvas-in-html5) RichTextBox [control](https://yourviews.mindstick.com/view/83439/bipartisan-gun-control-bill-passed-in-us-after-decades) from the toolbox on the [window Form](https://www.mindstick.com/forum/527/how-to-pass-datagridview-s-cells-value-to-another-window-form).

![RichTextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/79141034-506d-4ca8-819c-6223ed6b7a93/images/85e2f1be-6a9b-46e1-9955-7d688fdbe7e8.png)

Write the Text in RichTextBox

## ![RichTextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/79141034-506d-4ca8-819c-6223ed6b7a93/images/0ccff3e4-00a3-40aa-80a1-b6bd64fdd41c.png)

**[Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):**

```
Public Class Form1    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles MyBase.Load          'Find method is used to find the text written in RichTextBox         RichTextBox1.SelectionStart = RichTextBox1.Find("Hello")        RichTextBox1.SelectionColor = Color.BlueViolet        RichTextBox1.SelectionStart = RichTextBox1.Find("How are you")        RichTextBox1.SelectionColor = Color.DarkOliveGreen      End SubEnd Class
```

**Run the [Project](https://yourviews.mindstick.com/story/1788/things-to-ensure-your-construction-project-is-successful)**

![RichTextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/79141034-506d-4ca8-819c-6223ed6b7a93/images/4bc7929d-a2ad-4684-b33a-27b28732b75e.png)

## Save RichTextBox Text in File

## Code:

```
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click       ' SaveFile Method Saves the contents of the RichTextBox to a file.         RichTextBox1.SaveFile("hello.rtf")      End Sub     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles Button2.Click  'LoadFile Method Loads the contents of a file into the RichTextBox control.         RichTextBox2.LoadFile("hello.rtf")    End Sub
```

## Run the Project

![RichTextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/79141034-506d-4ca8-819c-6223ed6b7a93/images/470b98ea-45ba-4edc-ac67-2aa0d8eea801.png)

When you [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) save [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) then written text will save to the specified file and in specified path.

When you click Load button then saved file will load in RichTextBox2

![RichTextBox Control in VB.Net](https://www.mindstick.com/mindstickarticle/79141034-506d-4ca8-819c-6223ed6b7a93/images/bacdf7c7-757d-488b-b6c4-d8d3ce17fa75.png)

---

Original Source: https://www.mindstick.com/articles/315/richtextbox-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
