DataTable.DefaultView DataTable.DefaultView DataTable.DefaultView DataTable.DefaultView Property

정의

필터링된 뷰를 포함할 수 있는 테이블의 사용자 지정 뷰 또는 커서 위치를 가져옵니다.Gets a customized view of the table that may include a filtered view, or a cursor position.

public:
 property System::Data::DataView ^ DefaultView { System::Data::DataView ^ get(); };
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("DataTableDefaultViewDescr")]
public System.Data.DataView DefaultView { get; }
member this.DefaultView : System.Data.DataView
Public ReadOnly Property DefaultView As DataView

속성 값

DataView와 연결된 DataTable입니다.The DataView associated with the DataTable.

예제

속성을 설정 하는 다음 예제는 DataTable 개체의 DataView 를 통해를 DefaultView 속성입니다.The following example sets a property of the DataTable object's DataView through the DefaultView property. 또한이 예에서는 바인딩을 DataGridView 컨트롤을 DataTable "CompanyName." 라는 열이 포함 된 "공급자" 라는The example also shows the binding of a DataGridView control to a DataTable named "Suppliers" that includes a column named "CompanyName."

private void BindDataGrid()
{
    DataTable table = new DataTable();

    // Insert code to populate a DataTable with data.

    // Bind grid to DataTable.
    dataGrid1.DataSource = table;
}

private void ChangeRowFilter()
{
    DataTable gridTable = (DataTable) dataGrid1.DataSource;

    // Set the RowFilter to display a company names that 
    // begin with A through I..
    gridTable.DefaultView.RowFilter = "CompanyName < 'I'";
}
Private Sub BindDataGrid()
   Dim table As New DataTable

   ' Insert code to populate a DataTable with data.

   ' Bind DataGrid to DataTable
   DataGrid1.DataSource = table
End Sub 

Private Sub ChangeRowFilter()
   Dim gridTable As DataTable = _
       CType(dataGrid1.DataSource, DataTable)

   ' Set the RowFilter to display a company names 
   ' that begin with A through I.
   gridTable.DefaultView.RowFilter = "CompanyName < 'I'"
End Sub

설명

DefaultView 속성에서 반환을 DataView 정렬, 필터 및 검색에 사용할 수는 DataTable합니다.The DefaultView property returns a DataView you can use to sort, filter, and search a DataTable.

적용 대상

추가 정보