DataRow::Item Property (Int32)
.NET Framework (current version)
Gets or sets the data stored in the column specified by index.
Assembly: System.Data (in System.Data.dll)
public: property Object^ default[ int columnIndex ] { Object^ get(int columnIndex); void set(int columnIndex, Object^ value); }
Parameters
- columnIndex
-
Type:
System::Int32
The zero-based index of the column.
| Exception | Condition |
|---|---|
| DeletedRowInaccessibleException | Occurs when you try to set a value on a deleted row. |
| IndexOutOfRangeException | The columnIndex argument is out of range. |
| InvalidCastException |
When you set the property, an exception is generated if an exception occurs in the ColumnChanging event.
If this is an edit, see EndEdit for the exceptions that can be generated.
The following examples demonstrate the use of the Item property to get and set the value of a specific column index. The first example gets the value of the first column in any row that a user clicks in a DataGrid control.
.NET Framework
Available since 1.1
Available since 1.1
Show: