DataGrid コンストラクター

定義

DataGrid クラスの新しいインスタンスを初期化します。

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

次のコード例では、新System.Windows.Forms.DataGridしいメソッドを作成し、メソッドをSetDataBinding使用してプロパティをDataSourceDataMember設定します。

' 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

注釈

新しく作成 System.Windows.Forms.DataGrid されたコントロールに値を設定するには、プロパティを DataSource 有効なソース (例: DataViewDataSet、) に設定します DataViewManager

適用対象

こちらもご覧ください