Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets an enumerator that enables you to iterate through the ControlCollection instance.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public Function GetEnumerator As IEnumerator
'Usage
Dim instance As ControlCollection
Dim returnValue As IEnumerator
returnValue = instance.GetEnumerator()
public IEnumerator GetEnumerator()
public:
IEnumerator^ GetEnumerator()
public function GetEnumerator() : IEnumerator
Return Value
Type: System.Collections.IEnumerator
An IEnumerator for the ControlCollection instance.
Examples
The following code example adds a Button control to the top of the worksheet, and then uses GetEnumerator to display each control's name in a message box.
Private Sub ExcelControlGetEnumerator()
Dim Button1 As Microsoft.Office.Tools.Excel. _
Controls.Button = Me.Controls.AddButton( _
0, 0, 56.25, 17.25, "Button1")
Button1.Text = "OK"
Dim En As System.Collections.IEnumerator = _
Me.Controls.GetEnumerator()
While En.MoveNext()
MessageBox.Show(En.Current.ToString())
End While
End Sub
private void ExcelControlGetEnumerator()
{
Microsoft.Office.Tools.Excel.Controls.Button button1 =
this.Controls.AddButton(0, 0, 56.25, 17.25,
"button1");
button1.Text = "OK";
System.Collections.IEnumerator en = this.Controls.GetEnumerator();
while (en.MoveNext())
{
MessageBox.Show(en.Current.ToString());
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.