asp.net.ph

ConstraintCollection.RemoveAt Method

System.Data Namespace   ConstraintCollection Class


Removes the constraint at the specified index from the collection.

[ VB ]
Public Sub RemoveAt ( _
   ByVal index As Integer _
)

[ C# ]
public void RemoveAt (
   int index
);

[ C++ ]
public: void RemoveAt (
   int index
);

[ JScript ]
public function RemoveAt (
   index : int
);

Parameters

index
The index of the Constraint to remove.

Exceptions


Exception Type Condition
IndexOutOfRangeException Occurs when the collection does not have a constraint at this index.

Remarks

The IndexOf method returns the index of a given Constraint.

Use the Contains method to determine if the collection contains the target Constraint.

Use the CanRemove method to determine if a Constraint can be removed.the CollectionChanged event occurs if the removal succeeds.

Example

The following example uses the IndexOf method in conjunction with the RemoveAt method to remove a constraint from the ConstraintCollection.

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   CanRemove   Contains   IndexOf Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 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 asp.net.ph