Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataView Constructor

.NET Framework 1.1

Initializes a new instance of the DataView class.

Overload List

Initializes a new instance of the DataView class.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New()
[C#] public DataView();
[C++] public: DataView();
[JScript] public function DataView();

Initializes a new instance of the DataView class with the specified DataTable.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(DataTable)
[C#] public DataView(DataTable);
[C++] public: DataView(DataTable*);
[JScript] public function DataView(DataTable);

Initializes a new instance of the DataView class with the specified DataTable, RowFilter, Sort, and DataViewRowState.

Supported by the .NET Compact Framework.

[Visual Basic] Public Sub New(DataTable, String, String, DataViewRowState)
[C#] public DataView(DataTable, string, string, DataViewRowState);
[C++] public: DataView(DataTable*, String*, String*, DataViewRowState);
[JScript] public function DataView(DataTable, String, String, DataViewRowState);

Example

[Visual Basic, C#, C++] The following example creates a new DataView with the specified DataTable.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the DataView constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Private Sub MakeDataView(ds As DataSet)
   Dim dv As New DataView(ds.Tables("Suppliers"), _
                          "Country = 'UK'", _
                          "CompanyName", _
                          DataViewRowState.CurrentRows)
   dv.AllowEdit = True
   dv.AllowNew = True
   dv.AllowDelete = True
End Sub 'MakeDataView
End Class 'Sample 

[C#] 
private void MakeDataView(DataSet ds)
{
   DataView dv = new DataView(ds.Tables["Suppliers"], "Country = 'UK'", "CompanyName", DataViewRowState.CurrentRows);
   dv.AllowEdit = true;
   dv.AllowNew = true;
   dv.AllowDelete = true;
}

[C++] 
private:
    void MakeDataView(DataSet* ds)
    {
        DataView* dv = new DataView(ds->Tables->Item[S"Suppliers"], S"Country = 'UK'", S"CompanyName", DataViewRowState::CurrentRows);
        dv->AllowEdit = true;
        dv->AllowNew = true;
        dv->AllowDelete = true;
    };

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

DataView Class | DataView Members | System.Data Namespace

Show:
© 2015 Microsoft