Enterprise Library 3.1 - May 2007
Incorporating the Validation Application Block

The following procedure explains how to incorporate the Validation Application Block into your application.

To prepare your application

  1. Add a reference to the Validation Application Block assembly. In Visual Studio, right-click your project node in Solution Explorer, and then click Add References. Click the Browse tab and find the location of the Microsoft.Practices.EnterpriseLibrary.Validation.dll assembly. Select the assembly, and then click OK to add the reference.
  2. Use the same procedure to set a reference to the Enterprise Library Common assembly, named Microsoft.Practices.EnterpriseLibrary.Common.dll.
  3. Follow the same procedure to set a reference to the ObjectBuilder assembly, Microsoft.Practices.EnterpriseLibrary.ObjectBuilder.dll.
  4. If you are using the ASP.NET, Windows Forms, or WCF integration assemblies, add one of the following references as appropriate.
    1. Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.dll
    2. Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.dll
    3. Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF.dll
  5. Optional. To use elements from the Validation Application Block without fully qualifying the type with the namespace, add the following using statements (C#) or Imports statements (Visual Basic) to the top of your source code file.

    C#
    using Microsoft.Practices.EnterpriseLibrary.Validation;
    using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
    Visual Basic
    Imports Microsoft.Practices.EnterpriseLibrary.Validation
    Imports Microsoft.Practices.EnterpriseLibrary.Validation.Validators
    Cc309323.note(en-us,MSDN.10).gifNote:
    For Visual Basic projects, you can use the References page of the Project Designer to manage references and imported namespaces. To access the References page, select a project node in Solution Explorer. On the Project menu, click Properties. When the Project Designer appears, click the References tab.

Page view tracker