DataRowView.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 or sets a value in a specified column.

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

public object this[
	int ndx
] { get; set; }

Parameters

ndx
Type: System.Int32

The specified column.

Property Value

Type: System.Object

The value of the column.

The following example displays the value in each item of each DataRowView in a DataView.

private static void WriteViewRows(DataView view)
{
    int colCount = view.Table.Columns.Count;

    // Iterate through the rows of the DataView.
    foreach (DataRowView rowView in view)
    {
        // Display the value in each item of the DataRowView
        for (int i = 0; i < colCount; i++)
            Console.Write(rowView[i] + "\table");
        Console.WriteLine();
    }
}

.NET Framework
Available since 1.1
Return to top
Show: