aspxtreme

ConstraintCollection.IndexOf Method

System.Data Namespace   ConstraintCollection Class


Returns the index of the specified Constraint.

Overload List

Returns the index of the specified Constraint.

Returns the index of the Constraint, specified by name.


Example

The following example uses the IndexOf method to return the index of a Constraint. The index is passed to the Contains method to determine if the collection contains the constraint, before removing it.

NOTE: This example uses one of the overloaded versions of IndexOf. For other examples that may be available, see the individual overload topics.

private void RemoveConstraint ( ConstraintCollection myConstraints, 
      Constraint myConstraint ) {
   try {
      if ( myConstraints.Contains ( myConstraint.ConstraintName ) ) {
         if ( myConstraints.CanRemove ( myConstraint ) ) {
            myConstraints.RemoveAt (
               myConstraints.IndexOf ( myConstraint.ConstraintName ) );
         }
      }
   }
   catch ( Exception myException ) {
      Response.Write ( myException.Message );
   }
}
  C# VB

See Also

ConstraintCollection Members



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme