// the code below goes into the Declarations section of the form.
private void MakeDataView ( ) {
DataView dv = new DataView ( );
dv.Table = ds.Tables [ "Suppliers" ];
dv.AllowDelete = true;
dv.AllowEdit = true;
dv.AllowNew = true;
dv.RowFilter = "City = 'Berlin'";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;
dv.Sort = "CompanyName DESC";
// simple bind to a TextBox control
Text1.DataBindings.Add ( "Text", dv, "CompanyName" );
}
' the code below goes into the Declarations section of the form.
Private Sub MakeDataView ( )
Dim dv As DataView = New DataView
With dv
.Table = ds.Tables ( "Suppliers" )
.AllowDelete = True
.AllowEdit = True
.AllowNew = True
.RowFilter = "City = 'Berlin'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
.Sort = "CompanyName DESC"
End With
' simple bind to a TextBox control
Text1.Bindings.Add ( "Text", dv, "CompanyName" )
End Sub |