Treeview nodes & tooltips

I have a treeview control with several child nodes.
Each node has a different effect on my program and
I would like to state what they do as a tooltip for each
respective node.

Be default, the tooltip displayed is equal to the nodes
text. How can I make it display something else?

Please be clear in your answer.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you don't mind using the tag value of the nodes created, this should do what you are looking for:

This just uses a loop to build a bunch of nodes.  You can eaisly replace the loader with your specific items.
This code will run on a new form with a new treeview control.

Private Sub Form_Load()
   Dim cNode As Node
   Dim sItem As String
   Dim sTool As String
   Dim i As Integer
   Dim j As Integer
   Dim sItemChild As String
   For i = 1 To 10
      sItem = "Test Item " & i
      sTool = "Tool Tip " & i
      Set cNode = Me.TreeView1.Nodes.Add(, tvwChild, "Key" & i, sItem)
      cNode.Tag = sTool
      For j = 1 To 5
         sItemChild = "Test Child Item " & i & "," & j
         sTool = "Tool Tip " & i & "," & j
         Set cNode = Me.TreeView1.Nodes.Add(cNode, tvwChild, "Key" & i & "-" & j, sItemChild)
         cNode.Tag = sTool
End Sub

Private Sub TreeView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
   Dim cNode As Node
   Set cNode = TreeView1.HitTest(x, y)
   If TypeName(cNode) <> "Nothing" Then
      TreeView1.ToolTipText = cNode.Tag

      TreeView1.ToolTipText = ""
   End If
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.