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

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

Control.CreateControlCollection メソッド

サーバー コントロールの子コントロール (リテラルおよびサーバー両方) を保持する新しい ControlCollection オブジェクト作成します

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

Protected Overridable Function
 CreateControlCollection As ControlCollection
Dim returnValue As ControlCollection

returnValue = Me.CreateControlCollection
protected virtual ControlCollection CreateControlCollection ()
protected:
virtual ControlCollection^ CreateControlCollection ()
protected ControlCollection CreateControlCollection ()
protected function CreateControlCollection
 () : ControlCollection

戻り値
現在のサーバー コントロールの子サーバー コントロール格納する ControlCollection オブジェクト

解説解説
使用例使用例

CreateControlCollection メソッドオーバーライドして、ControlCollection クラス継承する CustomControlCollection クラスインスタンス作成するコード例次に示します

' Override the CreateControlCollection method to 
' write to the Trace object when tracing is enabled
' for the page or application in which this control
' is included.   
Protected Overrides Function
 CreateControlCollection() As ControlCollection
    Return New CustomControlCollection(Me)
End Function

// Override the CreateControlCollection method to 
// write to the Trace object when tracing is enabled
// for the page or application in which this control
// is included.   
protected override ControlCollection CreateControlCollection()
{
    return new CustomControlCollection(this);
}

CreateChildControls メソッドカスタム サーバー コントロール オーバーライドCreateControlCollection メソッド使用するコード例次に示します新しコレクション作成されfirstControlsecondControl2 つの子コントロール設定されます。

Protected Overrides Sub
 CreateChildControls()
   ' Creates a new ControlCollection. 
   Me.CreateControlCollection()
   
   ' Create child controls.
   Dim firstControl As New
 ChildControl()
   firstControl.Message = "FirstChildControl"
   
   Dim secondControl As New
 ChildControl()
   secondControl.Message = "SecondChildControl"
   
   Controls.Add(firstControl)
   Controls.Add(secondControl)
   
   ' Prevent child controls from being created again.
   ChildControlsCreated = True
End Sub 'CreateChildControls


protected override void CreateChildControls()
{               
   // Creates a new ControlCollection. 
   this.CreateControlCollection();

   // Create child controls.
    ChildControl firstControl = new ChildControl();
   firstControl.Message = "FirstChildControl";

   ChildControl secondControl = new ChildControl();
   secondControl.Message = "SecondChildControl";
   
   Controls.Add(firstControl);
   Controls.Add(secondControl);

   // Prevent child controls from being created again.
   ChildControlsCreated = true;
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.CreateControlCollection メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.CreateControlCollection メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.CreateControlCollection メソッド を検索

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

辞書ショートカット

すべての辞書の索引

「Control.CreateControlCollection メソッド」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS