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.
Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial DirectorThis was first published in April 2003