I have two forms. The first form “Main” has 2 buttons and a link label that I have set up tool tips for. My second form “settingsForm” has several tool tips as well. The tooltips all work correctly on the SettingsForm, however none work on the Main form. The tooltips for both forms are established within the same method which resides in the Main forms code. Here is how they are called:
public partial class Form1 : Form
{
FormSettings formSettings = new FormSettings();
ToolTip toolTip1 = new ToolTip();
public Form1()
{
InitializeComponent();
//does not work
toolTip1.SetToolTip(this.btnExit, "Shutdown the program");
//does work
toolTip1.SetToolTip(formSettings.btnSave, "Save the programs settings");
}
It also fails to work properly if I call it without the “this”
//does not work
toolTip1.SetToolTip(btnExit, "Shutdown the program");
Am I just calling the main form items incorrectly?
A tooltip control has to be associated with a single form.
The behavior of the tooltip control is that it will be “assigned” to the form associated with the last control that you call SetToolTip on. In your example, if you switch the order of the SetToolTips, they will be shown for the main form and not the settings form.
You need to add and use tooltip controls separately for each form.