TableRow コントロールのセルである TableCell オブジェクトのコレクションを表します。
名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Protected Class CellControlCollection
Inherits ControlCollection
'使用
Dim instance As CellControlCollection
protected class CellControlCollection : ControlCollection
private ref class CellControlCollection : public ControlCollection
protected class CellControlCollection extends ControlCollection
protected class CellControlCollection extends ControlCollection
適用できません。
解説
TableRow.CellControlCollection クラスは、TableRow コントロールの TableCell オブジェクトのコレクションを表します。TableCell オブジェクトを追加する場合、Add メソッドを使用すると、TableRow.CellControlCollection コレクションの末尾に、AddAt メソッドを使用すると、TableRow.CellControlCollection 内の指定したインデックス位置に追加できます。
TableRow.CellControlCollection コレクションに追加できるのは、TableCell オブジェクトだけです。
使用例
テーブルを作成し、プログラムによって要素をテーブルに追加してから、テーブルを Web ページに表示する方法のコード例を次に示します。TableRow コントロールの Cells プロパティが TableRow.CellControlCollection コレクションを表す方法、および Add メソッドを使用してセルを行に追加する方法に注意してください。
このコード例は、TableRow クラスのトピックで取り上げているコード例の一部分です。
' Create more rows for the table.
Dim rowNum As Integer
For rowNum = 2 To 9
Dim tempRow As New TableRow()
Dim cellNum As Integer
For cellNum = 0 To 2
Dim tempCell As New TableCell()
tempCell.Text = _
String.Format("({0},{1})", rowNum, cellNum)
tempRow.Cells.Add(tempCell)
Next
Table1.Rows.Add(tempRow)
Next
// Create more rows for the table.
for (int rowNum = 2; rowNum < 10; rowNum++)
{
TableRow tempRow = new TableRow();
for (int cellNum = 0; cellNum < 3; cellNum++)
{
TableCell tempCell = new TableCell();
tempCell.Text =
String.Format("({0},{1})", rowNum, cellNum);
tempRow.Cells.Add(tempCell);
}
Table1.Rows.Add(tempRow);
}
継承階層
System.Object
System.Web.UI.ControlCollection
System.Web.UI.WebControls.TableRow.CellControlCollection
スレッド セーフ
この型の public static (Visual Basicでは共有) メンバはすべて,スレッド セーフです。インスタンス メンバの場合は,スレッド セーフであるとは限りません。
プラットフォーム
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
TableRow.CellControlCollection メンバ
System.Web.UI.WebControls 名前空間
TableRow.CreateControlCollection
ControlCollection