다음을 통해 공유


DataTable.DefaultView 속성

필터링된 뷰를 포함할 수 있는 테이블의 사용자 지정 뷰 또는 커서 위치를 가져옵니다.

네임스페이스: System.Data
어셈블리: System.Data(system.data.dll)

구문

‘선언
Public ReadOnly Property DefaultView As DataView
‘사용 방법
Dim instance As DataTable
Dim value As DataView

value = instance.DefaultView
public DataView DefaultView { get; }
public:
property DataView^ DefaultView {
    DataView^ get ();
}
/** @property */
public DataView get_DefaultView ()
public function get DefaultView () : DataView

속성 값

DataTable과 관련된 DataView입니다.

설명

DefaultView 속성은 DataTable을 정렬, 필터링 및 검색하는 데 사용할 수 있는 DataView를 반환합니다.

예제

다음 예제에서는 DefaultView 속성을 통해 DataTable 개체의 DataView에 대한 속성을 설정합니다. 또한 이 예제에서는 "CompanyName"이라는 열이 포함된 "Suppliers"라는 DataTableDataGridView 컨트롤을 바인딩하는 방법을 보여 줍니다.

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
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'";
}

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

DataTable 클래스
DataTable 멤버
System.Data 네임스페이스

기타 리소스

DataTable 작성 및 사용