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

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

TableCellCollection.AddRange メソッド

指定した配列TableCell オブジェクトコレクション末尾追加します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub AddRange ( _
    cells As TableCell() _
)
Dim instance As TableCellCollection
Dim cells As TableCell()

instance.AddRange(cells)
public void AddRange (
    TableCell[] cells
)
public:
void AddRange (
    array<TableCell^>^ cells
)
public void AddRange (
    TableCell[] cells
)
public function AddRange (
    cells : TableCell[]
)

パラメータ

cells

コレクション追加する TableCell オブジェクト格納している配列

例外例外
例外種類条件

ArgumentNullException

cells パラメータの値が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

AddRange メソッド使用して配列TableCell オブジェクトを TableCellCollection に追加する方法の例を次に示します。この例では、TableRow の Cells プロパティは、TableCellCollection クラスインスタンスです。

      Sub Page_Load(sender As Object,
 e As EventArgs)
         Dim numRows As Integer
 = 3
         Dim numCells As Integer
 = 2
         ' Create 3 rows, each containing 2 cells.
         Dim i As Integer
         For i = 0 To numRows - 1
            Dim arrayOfTableRowCells(numCells-1) As
 TableCell
            Dim myTableRow As New
 TableRow()
            Dim j As Integer
         For j = 0 To numCells - 1
            Dim myTableCell As New
 TableCell()
            myTableCell.Text = "[Row " + i.ToString()
 + ", Cell " + j.ToString() + "]"
            arrayOfTableRowCells(j) = myTableCell
         Next j
      
            ' Get 'TableCellCollection' associated with the 'TableRow'.
            Dim myTableCellCol As TableCellCollection
 = myTableRow.Cells
            ' Add a row of cells. 
            myTableCellCol.AddRange(arrayOfTableRowCells)
            myTable.Rows.Add(myTableRow)
         Next i
End Sub 'Page_Load
void Page_Load(Object sender, EventArgs e)
{
   int numRows = 3;
   int numCells = 2;
   // Create 3 rows, each containing 2 cells.
   for (int i = 0; i < numRows; i++)
   {
      TableCell[] arrayOfTableRowCells = new TableCell[numCells];
      TableRow myTableRow = new TableRow();
      for (int j = 0; j < numCells; j++)
      {
         TableCell myTableCell = new TableCell();
         myTableCell.Text = "[Row " + i.ToString() + ", Cell "
 
                            + j.ToString()+ "]";
         arrayOfTableRowCells[j] = myTableCell;
      }
      
      // Get 'TableCellCollection' associated with the 'TableRow'.
      TableCellCollection myTableCellCol = myTableRow.Cells;
      // Add a row of cells. 
      myTableCellCol.AddRange(arrayOfTableRowCells);
      myTable.Rows.Add(myTableRow);
   }
}
void Page_Load(Object sender, EventArgs e) 
{
    int numRows = 3;
    int numCells = 2;
    // Create 3 rows, each containing 2 cells.
    for(int i=0;i < numRows;i++) {
        TableCell arrayOfTableRowCells[] = new TableCell[numCells];
        TableRow myTableRow =  new TableRow();
        
        for(int j=0;j < numCells;j++) {
            TableCell myTableCell =  new TableCell();
            myTableCell.set_Text("[Row " + System.Convert.ToString(i) 
                + ", Cell " + System.Convert.ToString(j) + "]");
            arrayOfTableRowCells .set_Item( j , myTableCell );
        } 
      
        // Get 'TableCellCollection' associated with the 'TableRow'.
        TableCellCollection myTableCellCol = myTableRow.get_Cells();
        // Add a row of cells. 
        myTableCellCol.AddRange(arrayOfTableRowCells);
        myTable.get_Rows().Add(myTableRow);
    } 
} //Page_Load
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TableCellCollection クラス
TableCellCollection メンバ
System.Web.UI.WebControls 名前空間
Add
AddAt
その他の技術情報
Table、TableRow、TableCell の各 Web サーバー コントロール



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS