ControlCollection.Contains Yöntem (Object)
Belirtilen denetim bir üyesi olup olmadığını belirleyen ControlCollection örneği.
Ad alanı: Microsoft.Office.Tools.Word
Derleme: Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)
Sözdizimi
'Bildirim
Function Contains ( _
control As Object _
) As Boolean
bool Contains(
Object control
)
Parametreler
- control
Tür: System.Object
İçinde arama yapmak istediğiniz denetimi ControlCollection örneği.
Dönüş Değeri
Tür: System.Boolean
true Denetim koleksiyonunda bulunmazsa; Aksi takdirde, false.
Örnekler
Aşağıdaki kod örneği ekler bir Button belge ve ardından görüntüler başlangıcına kontrol düğmesi bir ileti kutusunda indeksi.
Private Sub WordControlIndexOf()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Dim Button1 As Microsoft.Office.Tools.Word.Controls.Button _
= Me.Controls.AddButton(0, 0, 56.25F, 17.25F, "Button1")
Button1.Text = "OK"
If Me.Controls.Contains(Button1) Then
MessageBox.Show("The index of Button1 is " _
& Controls.IndexOf(Button1))
End If
End Sub
private void WordControlIndexOf()
{
this.Paragraphs[1].Range.InsertParagraphBefore();
Microsoft.Office.Tools.Word.Controls.Button button1 =
this.Controls.AddButton(0, 0, 56.25F, 17.25F,
"button1");
button1.Text = "OK";
if (this.Controls.Contains(button1))
{
MessageBox.Show("The index of button1 is " +
Controls.IndexOf(button1));
}
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.