ControlCollection.Remove(Control) Yöntem

Tanım

Belirtilen sunucu denetimini üst sunucu denetiminin ControlCollection nesnesinden kaldırır.

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)

Parametreler

value
Control

Kaldırılacak sunucu denetimi.

Örnekler

Aşağıdaki kod örneği, bir alt denetimi sunucu denetiminden myButton silmek için yöntemini kullanırRemove. İlk olarak kod, öğesinin Contains nesnesinde ControlCollection bulunup bulunmadığını myChildControl belirlemek için yöntemini kullanır ve varsa bunu kaldırır.

// 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

Açıklamalar

Dizin konumundan bir denetimi kaldırmak için yöntemini kullanın RemoveAt .

Şunlara uygulanır

Ayrıca bkz.