---
title: "ErrorProvider Control in VB.Net"  
description: "ErrorProvider allows us to set an error message for any control on the form when the input is not valid. When an error message is set, an icon indicat"  
author: "Pushpendra Singh"  
published: 2010-12-12  
updated: 2020-04-18  
canonical: https://www.mindstick.com/articles/296/errorprovider-control-in-vb-dot-net  
category: "vb.net"  
tags: ["vb.net"]  
reading_time: 2 minutes  

---

# ErrorProvider Control in VB.Net

ErrorProvider allows us to set an [error message](https://www.mindstick.com/forum/23174/error-message-the-page-you-are-requesting-cannot-be-served-because-of-the-extension-configuration) for any [control](https://yourviews.mindstick.com/view/83439/bipartisan-gun-control-bill-passed-in-us-after-decades) on the form when the input is not valid. When an error message is set, an icon indicating the error will appear next to the control and the error message is displayed as [Tool Tip](https://www.mindstick.com/articles/78/tool-tip-in-c-sharp) when the mouse is over the 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) ErrorProvider and [TextBox](https://www.mindstick.com/articles/320/textbox-control-in-vb-dot-net) control from toolbox on the [window Form](https://www.mindstick.com/forum/527/how-to-pass-datagridview-s-cells-value-to-another-window-form).

![ErrorProvider Control in VB.Net](https://www.mindstick.com/mindstickarticle/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/images/b95463e9-22b7-4120-b725-0bb7eab3e1e5.png)

![ErrorProvider Control in VB.Net](https://www.mindstick.com/mindstickarticle/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/images/5a9bb9f5-8eea-4ff8-9cd3-faa3f4f42d63.png)

Drag and drop a Button.

![ErrorProvider Control in VB.Net](https://www.mindstick.com/mindstickarticle/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/images/730cd16e-c9cb-4055-b4af-c5c156d0543a.png)

## Code:

```
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles Button1.Click         If TextBox1.Text =  "" Then ' condition is given so that empty textbox could not save ErrorProvider1.SetError(TextBox1, "Cannot leave textbox blank")'error text will show as tooltip           Else            ErrorProvider1.SetError(TextBox1, "")         End If       End SubEnd Class
```

**Run the project**

![ErrorProvider Control in VB.Net](https://www.mindstick.com/mindstickarticle/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/images/c4dc3e9f-7cf1-496c-b0b6-e8250c52327c.png)

If textbox is empty and Submit [button is clicked](https://answers.mindstick.com/qa/94813/why-does-my-app-terminate-when-the-button-is-clicked-on-android-studio) then error icon will display.

![ErrorProvider Control in VB.Net](https://www.mindstick.com/mindstickarticle/ece4d0e8-4332-4d0a-9fac-078fbe3f78dd/images/26a5bdff-9241-49b0-8749-673e52d2b78c.png)

When any value (text or number) is entered in textbox and Submit button clicked then form will execute.

## ErrorProvider Property:

**Icon property:** which allows us to set an icon that will be display when error occurred?

**BlinkRate property:** which allows setting the rate in milliseconds at which the icon blinks.

**Icon:** Gets or sets the Icon that is displayed next to a control when an error occurred.

**BlinkStyle:** Gets or sets a value indicating when the error icon flashes.

---

Original Source: https://www.mindstick.com/articles/296/errorprovider-control-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
