ConstraintCollection.Item Property (Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the Constraint from the collection at the specified index.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

Public ReadOnly Property Item (
	index As Integer
) As Constraint

Parameters

index
Type: System.Int32

The index of the constraint to return.

Property Value

Type: System.Data.Constraint

The Constraint at the specified index.

Exception Condition
IndexOutOfRangeException

The index value is greater than the number of items in the collection.

Use the Contains method to test for the existence of a specific constraint.

The following example gets each Constraint from the ConstraintCollection.

Private Sub GetConstraint(table As DataTable)
    Dim i As Integer
    For i = 0 To table.Constraints.Count - 1
        Console.WriteLine(table.Constraints(i).ConstraintName)
        Console.WriteLine(table.Constraints(i).GetType())
    Next i
 End Sub

.NET Framework
Available since 1.1
Return to top
Show: