Click here to Skip to main content
15,947,389 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I have a tab control with ShowToolTips = true.
It works fine for static tool tips that I assigned to the tabs using ToolTipText property.
Now I need to make the tool tips dynamic, i.e. change the tip's text before showing it, depending on the tab contents. So, I'd like to use something like MouseHover event to check which tab I am in and change the corresponding ToolTipText. Unfortunately, TabControl.MouseHover event does not tell me which tab the mouse hovers on.

Is there any other event/property I can use?

Thank you
Ravi Bhavnani 6-Jan-14 12:49pm    
Shouldn't you be checking the event on a TabPage (and not TabControl)? TabPage is a Control and handles MouseHover.


1 solution

TabControl supports selectedIndexChaged event. You can try this:

private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
    if (tabControl1.SelectedTab == tabPage1)
        toolTip1.SetToolTip(tabControl1, "TabPage1");
    else if (tabControl1.SelectedTab == tabPage1)
        toolTip1.SetToolTip(tabControl1, "TabPage2");

But perhaps you shoud consider to assign tooltip value for each individual tab page. This way you don't need to do any coding.
Share this answer
Member 10506786 6-Jan-14 14:00pm    
I need to change the tool tip text while mouse is hovering above the tabs, without changing selected tab - the same way as static tips are shown
Adam Zgagacz 6-Jan-14 14:10pm    
Now I understand. This is tough with .NET build-in tab control. However there are several tab controls you can find in CP. Below are just two examles (there are more). You can download one of them you like most and extend functionality to support your need.
Member 10506786 6-Jan-14 14:12pm    
got the answer from Microsoft C# forum:
Adam Zgagacz 6-Jan-14 14:18pm    
Nice solution. Congratulations!
Adam Zgagacz 6-Jan-14 15:02pm    
Btw, you should take your post out of unanswered questions. Othwerwise peple will be hitting your post while you already know the answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900