Compartilhar via


How to: Set ToolTips for Controls on a Windows Form at Design Time

You can set a ToolTip string in code or in the Windows Forms Designer. For more information about the ToolTip component, see ToolTip Component Overview (Windows Forms).

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To set a ToolTip programmatically

  1. Add the control that will display the ToolTip.

  2. Use the SetToolTip method of the ToolTip component.

    ' In this example, Button1 is the control to display the ToolTip.
    ToolTip1.SetToolTip(Button1, "Save changes")
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1.SetToolTip(button1, "Save changes");
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1.SetToolTip(button1, "Save changes");
    
    // In this example, button1 is the control to display the ToolTip.
    toolTip1->SetToolTip(button1, "Save changes");
    

To set a ToolTip in the designer

  1. Add a ToolTip component to the form.

  2. Select the control that will display the ToolTip, or add it to the form.

  3. In the Properties window, set the ToolTip on ToolTip1 value to an appropriate string of text.

See Also

Tasks

How to: Change the Delay of the Windows Forms ToolTip Component

Reference

ToolTip Component Overview (Windows Forms)

Other Resources

ToolTip Component (Windows Forms)