I am using an InputBox function to prompt for a name for a new node within a tree control at runtime. Is there a way to have an empty box next to the new node in the tree for the user to supply a name, similar to a new folder within Windows Explorer? Thanks
Add an imagelist to a form. Add an image to the imagelist and set the key to "icon"
Form should have a treeview and a textbox (I know you said inputbox, but bare with me). Add the following code inside of your form. Start the project, type anything into the textbox, and then click the node. Voila! Your node now has text.
Private Sub Form_Load()
TreeView1.ImageList = ImageList1
Dim nodX As Node
Set nodX = TreeView1.Nodes.Add(, , , "")
nodX.Image = "icon"
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
TreeView1.Nodes(1).Text = Text1.Text
End Sub
Can you explain the purpose of the imagelist and nodX.Image? I'll have to try this out when I have time to see HOW it works. The only way I've seen this done before is to postion a text box OVER the other control, accept the input into that, then transfer it to the background control and undisplay the textbox when it loses focus. This sure looks a lot easier.
Tracy Dryden
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.