DataGrid Konstruktor
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Inicjuje nowe wystąpienie klasy DataGrid.
public:
DataGrid();
public DataGrid ();
Public Sub New ()
Przykłady
Poniższy przykład kodu tworzy nowy System.Windows.Forms.DataGrid i używa SetDataBinding metody , aby ustawić DataSource właściwości i 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
Uwagi
Aby wypełnić nowo utworzoną System.Windows.Forms.DataGrid kontrolkę, ustaw DataSource właściwość na prawidłowe źródło, takie jak DataView, DataSetlub DataViewManager.