Bahasa

ControlCollection.RemoveAt(Int32) Metode

Definisi

Menghapus kontrol anak, di lokasi indeks yang ditentukan, dari ControlCollection objek.

public:
 virtual void RemoveAt(int index);
public virtual void RemoveAt(int index);
abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit
Public Overridable Sub RemoveAt (index As Integer)

Parameter

index
Int32

Indeks ordinal kontrol server yang akan dihapus dari koleksi.

Pengecualian

ControlCollection bersifat baca-saja.

Contoh

Contoh kode berikut menggunakan RemoveAt metode untuk menghapus kontrol anak dari myButton kontrol server. Panggilan metode pertama-tama menentukan lokasi indeks 1 tempat kontrol dihapus. Contoh kemudian menulis ke halaman yang berisi pesan teks yang mengatakan bahwa kontrol di lokasi tersebut ControlCollection telah dihapus dari koleksi.

// Use the RemoveAt method to delete the child control
// at index location 1.           
myButton.Controls.RemoveAt(1);
msgRemoveAt.Text = "The control at index location 1 has been removed.";
' Use the RemoveAt method to delete the child control
' at index location 1.           
myButton.Controls.RemoveAt(1)
msgRemoveAt.Text = "The control at index location 1 has been removed."

Keterangan

Untuk menghapus kontrol dari koleksi berdasarkan nilainya, gunakan Remove metode .

Berlaku untuk

Lihat juga