ControlCollection.Remove(Control) 메서드

정의

지정된 서버 컨트롤을 부모 서버 컨트롤의 ControlCollection 개체에서 제거합니다.

public:
 virtual void Remove(System::Web::UI::Control ^ value);
public virtual void Remove (System.Web.UI.Control value);
abstract member Remove : System.Web.UI.Control -> unit
override this.Remove : System.Web.UI.Control -> unit
Public Overridable Sub Remove (value As Control)

매개 변수

value
Control

제거할 서버 컨트롤입니다.

예제

다음 코드 예제에서는 합니다 Remove 에서 자식 컨트롤을 삭제 하는 방법의 myButton 서버 컨트롤입니다. 먼저 코드를 사용 하 여는 Contains 결정 하는 방법 여부를 합니다 myChildControl 에 포함 된를 ControlCollection 개체, 경우 제거 합니다.

// Use the Contains method to check whether
// a child control exists, and if it does,
// use the Remove method to delete it.        
if (myButton.Controls.Contains(myChildControl))
{
   myButton.Controls.Remove(myChildControl);
   msgRemove.Text = "You removed myLiteralControl.";
}
else msgRemove.Text="The control to remove does not exist." ;
' Use the Contains method to check whether
' a child control exists, and if it does,
' use the Remove method to delete it.        
If myButton.Controls.Contains(myChildControl)
   myButton.Controls.Remove(myChildControl)
   msgRemove.Text = "You removed myLiteralControl."
Else
   msgRemove.Text="The control to remove does not exist." 
End If

설명

인덱스 위치에서 컨트롤을 제거 하려면 사용 된 RemoveAt 메서드.

적용 대상

추가 정보