Problem solve Get help with specific problems with your technologies, process and projects.

How to use errorprovider control to validate a textbox

Create an icon that will blink at the right side of the control when validated incorrectly.

This tip was submitted to the VS.NET Info Center by member Thomson Alexander. Please let other users know how useful it is by rating it below.


Let's say you have a form with textbox control, textbox1. Place an errorprovider control on the form (it is not a visible control).

In the textbox "leave" event, you can drop the following code to validate it for null value:

 if text1.text ="" then errorprovider.seterror (textbox1,"Data should not be blank") else 'clear the error description errorprovider.seterror(textbox1,"") end if

An icon will blink at the right side of the control when validated incorrectly.

Dig Deeper on Win Development Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

Close