DataGrid Costruttore

Definizione

Inizializza una nuova istanza della classe DataGrid.

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

Esempio

Nell'esempio di codice seguente viene creato un nuovo System.Windows.Forms.DataGrid oggetto e viene utilizzato il SetDataBinding metodo per impostare le DataSource proprietà e 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

Commenti

Per popolare un controllo appena creato System.Windows.Forms.DataGrid , impostare la DataSource proprietà su un'origine valida, ad esempio DataView, DataSeto DataViewManager.

Si applica a

Vedi anche