Aracılığıyla paylaş


ControlCollection.IndexOf Yöntem (Object)

Belirtilen denetim için arar ve ilk geçtiği sıfır tabanlı dizini döndürür ControlCollection örneği.

Ad alanı:  Microsoft.Office.Tools.Excel
Derleme:  Microsoft.Office.Tools.Excel (Microsoft.Office.Tools.Excel.dll içinde)

Sözdizimi

'Bildirim
Function IndexOf ( _
    control As Object _
) As Integer
int IndexOf(
    Object control
)

Parametreler

Dönüş Değeri

Tür: System.Int32
Dizin denetimi veya denetim içinde değilse -1 ControlCollection örneği.

Örnekler

Aşağıdaki kod örneği ekler bir Button dizin bir ileti kutusunda düğmesinin üstüne çalışma ve sonra görüntüler için kontrol.

Private Sub ExcelControlIndexOf()

    Dim Button1 As Microsoft.Office.Tools.Excel. _
        Controls.Button = Me.Controls.AddButton( _
        0, 0, 56.25, 17.25, "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 ExcelControlIndexOf()
{

    Microsoft.Office.Tools.Excel.Controls.Button button1 =
        this.Controls.AddButton(0, 0, 56.25, 17.25,
        "button1");
    button1.Text = "OK";

    if (this.Controls.Contains(button1))
    {
        MessageBox.Show("The index of button1 is " +
            Controls.IndexOf(button1));
    }
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

ControlCollection Arabirim

IndexOf Fazla Yük

Microsoft.Office.Tools.Excel Ad Alanı