DataGrid Constructor
Initializes a new instance of the System.Windows.Forms.DataGrid class.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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.
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
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.