System.Data Namespace DataRowView Class
Sets or retrieves a value in a specified column given the column name.
Object variable = DataRowView.Item [ columnName ];
... or ...
Object variable = DataRowView [ columnName ];
dim variable as Object = DataRowView.Item ( columnName )
... or ...
dim variable as Object = DataRowView ( columnName )
variable : Object = DataRowView.Item ( columnName );
... or ...
variable : Object = DataRowView ( columnName ); |
|
C# |
VB |
JScript |
- columnName
- The name of a DataColumn to set or get a value.
The value of the column.
The following example appends text to the value of a column in each modified row of a DataView.
private void SetDataRowView ( ) {
DataView dv = ( DataView ) myGrid.DataSource;
// set the filter to display only those rows that were modified.
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
// change the value of the CompanyName column for each modified row.
foreach ( DataRowView drv in dv ) {
drv [ "CompanyName" ] += " new value";
}
}
Private Sub SetDataRowView ( )
Dim dv As DataView = CType ( myGrid.DataSource, DataView )
' set the filter to display only those rows that were modified.
dv.RowStateFilter = DataViewRowState.ModifiedCurrent
' change the value of the CompanyName column for each modified row.
Dim drv As DataRowView
For Each drv In dv
drv ( "CompanyName" ) = drv ( "CompanyName" ).ToString ( ) + " new value"
Next drv
End Sub |
|
C# |
VB |
DataRowView Members DataRowView.Item Overload List