O'Reilly logo

Programming Visual Basic 2005 by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Summary Validator

You have great control over how validation errors are reported. For example, rather than putting error messages alongside the control, you can summarize all the validation failures with a ValidationSummary control. This control can place a summary of the errors in a bulleted list, a simple list, or a paragraph that appears on the web page or in a pop-up message box.

Add a ValidationSummary control at the bottom of the page (after the table). There are a few properties to set in the design view. Set the id to valSum (that becomes the ID of the validation summary control). Next set the DisplayMode by clicking on the Display Mode property. Notice that the various valid display modes are displayed in a drop-down list, as shown in Figure 9-8.

Interestingly, if you choose to set these attributes by hand, in Source Mode, IntelliSense helps you with the valid Display Modes as well, as shown in Figure 9-9. You can leave the default, BulletList, for now.

In addition to choosing among a BulletList, List, or SingleParagraph format for displaying the list of errors, you must decide on whether to show a summary at the bottom of the page and/or a pop-up message box. You configure this using the ShowMessageBox and ShowSummary properties, as shown in Figure 9-10.

Set ShowMessageBox to True and ShowSummary to False for now.

The HeaderText property holds the header that will be displayed if there are errors to report. Set it to The following errors were found:.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required