Treeview nodes & tooltips

Posted on 1999-10-29
Medium Priority
Last Modified: 2010-05-02

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.

Question by:blue021097
1 Comment

Accepted Solution

LorenG earned 600 total points
ID: 2170315
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question