Compartilhar via


Button.Select Method

Selects the Button.

Namespace:  Microsoft.Office.Tools.Word.Controls
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub Select
public void Select()

Examples

The following code example adds two Button controls to a document and then programmatically selects the first button by using the Select method.

This example is for a document-level customization.

Private Sub SelectControl()
    Dim Button1 As Microsoft.Office.Tools.Word.Controls.Button = _
        Me.Controls.AddButton(25, 25, 80, 30, "Button1")
    Button1.Text = "Button 1" 

    Dim Button2 As Microsoft.Office.Tools.Word.Controls.Button = _
        Me.Controls.AddButton(25, 100, 80, 30, "Button2")
    Button2.Text = "Button 2" 

    ' Programmatically select the first button.
    Button1.Select()
End Sub
private void SelectControl()
{
    Microsoft.Office.Tools.Word.Controls.Button button1 =
        this.Controls.AddButton(25, 25, 80, 30, "button1");
    button1.Text = "Button 1";

    Microsoft.Office.Tools.Word.Controls.Button button2 =
        this.Controls.AddButton(25, 100, 80, 30, "button2");
    button2.Text = "Button 2";

    // Programmatically select the first button.
    button1.Select();
}

.NET Framework Security

See Also

Reference

Button Class

Select Overload

Microsoft.Office.Tools.Word.Controls Namespace