Home > Guides > Programming > .NET and Windows Programming

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

Displaying Errors with the Error Provider

Last updated Aug 19, 2004.

One of the more difficult parts of any user interface is error detection and notification. When the user fills out a form and submits it, the program must verify that the data is valid before saving it to a database or continuing with processing. If the program finds errors in the user's input data, then it must display some kind of error notification. Over the years, programmers have used many different error notification schemes with message boxes or form icons. Windows Forms formalizes and standardizes the error notification process with the ErrorProvider component.

A Simple Example

As an example of using the ErrorProvider, consider the "New Contact" dialog box for a simple telephone book application. A sample dialog is shown in Figure 1.

Figure 2Figure 1

Data entry rules are very simple. The user must enter values for both fields, and the Phone field must contain a 10-digit number entered with no punctuation. For example, the number (702)555-1212 would be entered 7025551212. If all of these conditions are met, the program accepts the data input, signified by a message box. If any one or more of the conditions is not met, the program should indicate the error and allow the user to fix it. The program indicates the error by placing an exclamation icon next to the control that is in error. The user can hover the mouse over the icon to see the error message. An example is shown in Figure 2.

Figure 2Figure 2

Discussions

Copies of the array?
Posted Dec 23, 2008 03:40 PM by luige21
1 Replies
Hi
Posted Dec 5, 2008 05:10 AM by ajay2000bhushan
2 Replies
You have no clue.
Posted Jun 10, 2008 03:28 PM by theinternetmaster
1 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jim Mischel"Highly unlikely" does not mean "impossible"
By Jim MischelJuly 18, 2009 No Comments

One of my programs crashed the other day in a very unexpected place.  A call to System.Threading.ConcurrentQueue.TryDequeue (from the Parallel Extensions to .NET) resulted in an OverflowException being thrown.  Investigation revealed a pretty serious bug in the System.Random constructor.

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part II
By John TraenkenschuhMay 24, 2009 No Comments

In the last blog in this series, Traenk relates his first experiences with computers and with coding.  But now, some years have passed. . .

It's Here; Put Away Your Pre-Conceptions on What an OS Must Be: Part I
By John TraenkenschuhMay 24, 2009 No Comments

Traenk relates his past experience with Operating Systems that goes back 25 years, ok, more than that but he ain't tellin'

See More Blogs

Informit Network