DataGrid 생성자

정의

DataGrid 클래스의 새 인스턴스를 초기화합니다.

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

예제

다음 코드 예제에서는 새로 System.Windows.Forms.DataGrid 만들고 메서드를 SetDataBinding 사용 하 여 설정 및 DataSource DataMember 속성입니다.

' 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

설명

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.

적용 대상

추가 정보