ControlCollection.AddAt メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As ControlCollection Dim index As Integer Dim child As Control instance.AddAt(index, child)



AddAt メソッドを使用して、ChildControl2 という名前の新しい LiteralControl を作成し、インデックス位置 1 にある myButton コントロールの ControlCollection コレクションに追加するコード例を次に示します。
' Create a LiteralControl and use the Add method to add it ' to a button's ControlCollection, then use the AddAt method ' to add another LiteralControl to the collection at the ' index location of 1. Dim myLiteralControl As LiteralControl = _ new LiteralControl("ChildControl1") myButton.Controls.Add(myLiteralControl) myButton.Controls.AddAt(1,new LiteralControl("ChildControl2")) Response.Write("<b>ChildControl2 is added at index 1</b>") ' Get the Index location of the myLiteralControl LiteralControl ' and write it to the page. Response.Write("<br><b>Index of the ChildControl myLiteralControl is </b>" & _ myButton.Controls.IndexOf(myLiteralControl))

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ControlCollection.AddAt メソッドのページへのリンク