DataView Constructor

DataView Constructor ()


Initializes a new instance of the DataView class.

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

public DataView()

The following example creates a new DataView.

private void MakeDataView()
    DataView view = new DataView();

    view.Table = DataSet1.Tables["Suppliers"];
    view.AllowDelete = true;
    view.AllowEdit = true;
    view.AllowNew = true;
    view.RowFilter = "City = 'Berlin'";
    view.RowStateFilter = DataViewRowState.ModifiedCurrent;
    view.Sort = "CompanyName DESC";

    // Simple-bind to a TextBox control
    Text1.DataBindings.Add("Text", view, "CompanyName");

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft