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,289 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

12 Experts available now in Live!

Get 1:1 Help Now