DataGrid 생성자

정의

DataGrid 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DataGrid class.

public:
 DataGrid();
public DataGrid ();
Public Sub New ()

예제

다음 코드 예제에서는 새를 만들고 System.Windows.Forms.DataGrid 메서드를 사용 하 여 SetDataBinding 및 속성을 설정 합니다 DataSource DataMember .The following code example creates a new System.Windows.Forms.DataGrid and uses the SetDataBinding method to set the DataSource and DataMember properties.

' This object variable must go in the Declarations section:
Private DataGrid1 As DataGrid
 
Private Sub CreateDataGrid()
   ' Initialize a new DataGrid control.
   me.Datagrid1 = New DataGrid
   
   Dim myDataSet As DataSet = New DataSet("myDataSet")
   Dim myDataTable As DataTable = New DataTable("Customers")
   myDataSet.Tables.Add(myDataTable)
   ' Insert code to populate the DataTable with rows.
   ' Set the DataSource and DataMember of the DataGrid control.
   DataGrid1.SetDataBinding(myDataSet, "Customers")
End Sub

설명

새로 만든 컨트롤을 채우려면 System.Windows.Forms.DataGrid DataSource 속성을, 또는와 같은 유효한 소스로 설정 DataView DataSet DataViewManager 합니다.To populate a newly created System.Windows.Forms.DataGrid control, set the DataSource property to a valid source, such as a DataView, DataSet, or DataViewManager.

적용 대상

추가 정보