Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
1,336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
KarunSK earned 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

597 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