DataGrid Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the DataGrid class.
public:
DataGrid();
public DataGrid ();
Public Sub New ()
Examples
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
Remarks
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.
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET