Edit

Share 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 in Visual Studio. For more information about the ToolTip component, see ToolTip Component Overview.

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");
    

Set a ToolTip in the designer

  1. In Visual Studio, 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.

To remove a ToolTip programmatically

  1. Use the SetToolTip method of the ToolTip component.

    ' In this example, Button1 is the control displaying the ToolTip.
    ToolTip1.SetToolTip(Button1, Nothing)
    
    // In this example, button1 is the control displaying the ToolTip.
    toolTip1.SetToolTip(button1, null);
    
    // In this example, button1 is the control displaying the ToolTip.
    toolTip1->SetToolTip(button1, NULL);
    

Remove a ToolTip in the designer

  1. In Visual Studio, select the control that is displaying the ToolTip.

  2. In the Properties window, delete the text in the ToolTip on ToolTip1.

See also