DataGridTextBox.SetDataGrid メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridTextBox.SetDataGrid メソッドの意味・解説 

DataGridTextBox.SetDataGrid メソッド

TextBox コントロール属すDataGrid設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Sub SetDataGrid ( _
    parentGrid As DataGrid _
)
Dim instance As DataGridTextBox
Dim parentGrid As DataGrid

instance.SetDataGrid(parentGrid)
public void SetDataGrid (
    DataGrid parentGrid
)
public:
void SetDataGrid (
    DataGrid^ parentGrid
)
public void SetDataGrid (
    DataGrid parentGrid
)
public function SetDataGrid (
    parentGrid : DataGrid
)

パラメータ

parentGrid

コントロールホストとなる DataGrid コントロール

使用例使用例
' Create a DataSet with a table and populate it.
Private Sub MakeDataSet()
   myDataSet = New DataSet("myDataSet")
   Dim tPer As New DataTable("Person")
   Dim cPerName As New DataColumn("PersonName")

   tPer.Columns.Add(cPerName)
   myDataSet.Tables.Add(tPer)

   Dim newRow1 As DataRow
   Dim i As Integer
   For i = 1 To 5
      newRow1 = tPer.NewRow()
      tPer.Rows.Add(newRow1)
   Next i

   tPer.Rows(0)("PersonName") = "Robert"
   tPer.Rows(1)("PersonName") = "Michael"
   tPer.Rows(2)("PersonName") = "John"
   tPer.Rows(3)("PersonName") = "Walter"
   tPer.Rows(4)("PersonName") = "Simon"

   ' Bind the 'DataSet' to the 'DataGrid'.
   myDataGrid.SetDataBinding(myDataSet, "Person")
   myDataGridTextBox.DataBindings.Add("Text", myDataSet,
 "Person.PersonName")
   ' Set the DataGrid to the DataGridTextBox.
   myDataGridTextBox.SetDataGrid(myDataGrid)
End Sub 'MakeDataSet
// Create a DataSet with a table and populate it.
private void MakeDataSet()
{
   myDataSet = new DataSet("myDataSet");

   DataTable tPer = new DataTable("Person");

   DataColumn cPerName = new DataColumn("PersonName");
   tPer.Columns.Add(cPerName);

   myDataSet.Tables.Add(tPer);

   DataRow newRow1;

   for(int i = 1; i < 6; i++)
   {
      newRow1 = tPer.NewRow();
      tPer.Rows.Add(newRow1);
   }

   tPer.Rows[0]["PersonName"] = "Robert";
   tPer.Rows[1]["PersonName"] = "Michael";
   tPer.Rows[2]["PersonName"] = "John";
   tPer.Rows[3]["PersonName"] = "Walter";
   tPer.Rows[4]["PersonName"] = "Simon";

   // Bind the 'DataSet' to the 'DataGrid'.
   myDataGrid.SetDataBinding(myDataSet, "Person");
   myDataGridTextBox.DataBindings.Add("Text",myDataSet,"Person.PersonName");
   // Set the DataGrid to the DataGridTextBox.
   myDataGridTextBox.SetDataGrid(myDataGrid);
}
   // Create a DataSet with a table and populate it.
private:
   void MakeDataSet()
   {
      myDataSet = gcnew DataSet( "myDataSet" );
      DataTable^ tPer = gcnew DataTable( "Person" );
      DataColumn^ cPerName = gcnew DataColumn( "PersonName" );
      tPer->Columns->Add( cPerName );
      myDataSet->Tables->Add( tPer );
      DataRow^ newRow1;
      for ( int i = 1; i < 6; i++ )
      {
         newRow1 = tPer->NewRow();
         tPer->Rows->Add( newRow1 );
      }
      tPer->Rows[ 0 ][ "PersonName" ] = "Robert";
      tPer->Rows[ 1 ][ "PersonName" ] = "Michael";
      tPer->Rows[ 2 ][ "PersonName" ] = "John";
      tPer->Rows[ 3 ][ "PersonName" ] = "Walter";
      tPer->Rows[ 4 ][ "PersonName" ] = "Simon";

      // Bind the 'DataSet' to the 'DataGrid'.
      myDataGrid->SetDataBinding( myDataSet, "Person" );
      myDataGridTextBox->DataBindings->Add( "Text", myDataSet, "Person::PersonName"
 );

      // Set the DataGrid to the DataGridTextBox.
      myDataGridTextBox->SetDataGrid( myDataGrid );
   }
// Create a DataSet with a table and populate it.
private void MakeDataSet()
{
    myDataSet = new DataSet("myDataSet");

    DataTable tPer = new DataTable("Person");
    DataColumn cPerName = new DataColumn("PersonName");

    tPer.get_Columns().Add(cPerName);
    myDataSet.get_Tables().Add(tPer);

    DataRow newRow1;

    for (int i = 1; i < 6; i++) {
        newRow1 = tPer.NewRow();
        tPer.get_Rows().Add(newRow1);
    }

    tPer.get_Rows().get_Item(0).set_Item("PersonName", "Robert");
    tPer.get_Rows().get_Item(1).set_Item("PersonName", "Michael");
    tPer.get_Rows().get_Item(2).set_Item("PersonName", "John");
    tPer.get_Rows().get_Item(3).set_Item("PersonName", "Walter");
    tPer.get_Rows().get_Item(4).set_Item("PersonName", "Simon");

    // Bind the 'DataSet' to the 'DataGrid'.
    myDataGrid.SetDataBinding(myDataSet, "Person");
    myDataGridTextBox.get_DataBindings().Add("Text", myDataSet, 
        "Person.PersonName");

    // Set the DataGrid to the DataGridTextBox.
    myDataGridTextBox.SetDataGrid(myDataGrid);
} //MakeDataSet
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

DataGridTextBox.SetDataGrid メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridTextBox.SetDataGrid メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS