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

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

Control.ControlCollection.RemoveAt メソッド

指定したインデックス位置にあるコントロール コレクションからコントロールを削除します。

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

解説解説
使用例使用例

派生クラス Panel の Control.ControlCollection 内のコレクション数が 0 より大きい場合に、コレクション内の最初の Control を削除するコード例を次に示します。この例では、Form 上に、Panel、Button、および 1 つ以上のその他のコントロールが作成されている必要があります。その他のコントロールは Panel コントロールに追加され、Panel コントロールは Form に追加されます。ボタンがクリックされると、パネルに含まれている最初のコントロールが Control.ControlCollection から削除されます。

' Remove the first control in the collection.
Private Sub RemoveAtButton_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 RemoveAtButton.Click
    If (Panel1.Controls.Count > 0) Then
        Panel1.Controls.RemoveAt(0)
    End If
End Sub
// Remove the first control in the collection.
private void removeAtButton_Click(object sender,
 System.EventArgs e)
{
   if (panel1.Controls.Count > 0)
   {
      panel1.Controls.RemoveAt(0);
   }
}
   // Remove the first control in the collection.
private:
   void removeAtButton_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      if ( panel1->Controls->Count > 0 )
      {
         panel1->Controls->RemoveAt( 0 );
      }
   }
// Remove the first control in the collection.
private void removeAtButton_Click(Object sender,
 System.EventArgs e)
{
    if (panel1.get_Controls().get_Count() > 0) {
        panel1.get_Controls().RemoveAt(0);
    }
} //removeAtButton_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Control.ControlCollection クラス
Control.ControlCollection メンバ
System.Windows.Forms 名前空間
Remove
Clear
Add



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

Control.ControlCollection.RemoveAt メソッドのお隣キーワード

   

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



Control.ControlCollection.RemoveAt メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS