The DataRow Class
This class represents one row of data in a DataTable. Every row in a DataTable has the same structure (which corresponds to the column structure of the overall table).
This class has no constructors; you can't simply create a data row "out of nowhere." To create a new data row on an existing table, you call the table's NewRow method.
DataRow row = tbl.NewRow(); row.NodeName = 'MyPoint'; row.X = 2; row.Y = -1.5;
Since a DataRow object represents an actual row in the table, any changes you make to a data row's column values (such as the property assignments shown above) are automatically stored in the table.
Here are the properties and methods of the DataRow class:
void Clear()
This method clears all of the values in this data row (just as when it was first created).
void ClearColumn(columnIndicator)
This method clears the value in the specified column in this data row. Its argument is:
value columnIndicatorvalue GetColumnValue(columnIndicator)
This method gets the value in the specified column in this data row.
DataRow row = tbl[2]; // Obtain a data row somehow. double angle; angle = row.GetColumnValue('ArcAngle'); // This works, but… angle = row.ArcAngle; // …this is the usual way // to do it.
This method's argument is:
value columnIndicatorint RowIndex { get; }
This read-only property gives the index of this data row within its parent data table. The first row is at index zero.
void SetColumnValue(columnIndicator, data)
This method sets the value in the specified column in this data row.
DataRow row = tbl[2]; // Obtain a data row somehow. row.SetColumnValue('ArcAngle', 30); // This works, but… row.ArcAngle = 30; // …this is the usual way // to do it.
This method's arguments are:
value columnIndicatorvalue data
The new value that is to be stored in the specified column of this row.void SetValues(…)
This method sets all the values in this data row.
This method can take a single argument, which is a list of the values in column sequence:
Or, this method can take an arbitrary number of arguments, which are the values in column sequence.