Solved

In VB.NET how do you clear the Error Provider Icon from a form once it has been displayed?

Posted on 2004-04-05
2
1,293 Views
Last Modified: 2008-05-29
I have this code:

Dim err1 as New ErrorProvider


If TextBox1.Text = ""

e.Cancel = True
err1.SetError(TextBox1, "Please Enter A Name")

Else

e.Cancel = False
err1.SetError(TextBox1, "")

End If

But what I want to know is how you clear the icon, if the user leaves the Textbox blank and then hits tab the error provider ICON is placed on the form next to the
Textbox control, but then if they enter a valid value and hit tab the icon stays next to the box.  I don't want my users to think that there is still a problem.

I have the above code in the "Validating" event for the textbox.
0
Comment
Question by:UberDeveloper
2 Comments
 
LVL 6

Accepted Solution

by:
KarunSK earned 500 total points
ID: 10761151
This is because you are creating a new ErrorProvider object each time you validate. You need to create the error provider object at the form level (like Form_Load) and then use it in your Validating event.

Karun.
0
 
LVL 2

Author Comment

by:UberDeveloper
ID: 10761165
Great, Thanks, I didn't even think about that.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help parsing JSON in my VB.Net application 4 86
Two different visual studio versions 3 29
Syntax Error 2 62
Powershell File Sort 8 24
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now