Solved

treeview building

Posted on 1998-12-14
6
197 Views
Last Modified: 2010-05-03
i am trying to build a stair tree. i have succeeded in building a root node and a few children with the treeview.nodes.add but for some reason when i try to build a two level tree of questions answers meaning:
q
---a
q
---a
q
---a
as it is writen in the help file, i get a debug msg. that the object is not found. can you write me an example that builds a tree like the example above.
thank you.
p.s i'm using vb6.
0
Comment
Question by:ilanm
  • 4
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
Inteqam earned 50 total points
Comment Utility
insert a treeview in a form and paste the following:

Private Sub Form_Load()
Dim n As Node

Set n = Me.TreeView1.Nodes.Add(, , "root", "root")
Set n = Me.TreeView1.Nodes.Add("root", tvwChild, "q1", "q")
Set n = Me.TreeView1.Nodes.Add("root", tvwChild, "q2", "q")
Set n = Me.TreeView1.Nodes.Add("root", tvwChild, "q3", "q")
Set n = Me.TreeView1.Nodes.Add("q1", tvwChild, "a1", "a")
Set n = Me.TreeView1.Nodes.Add("q2", tvwChild, "a2", "a")
Set n = Me.TreeView1.Nodes.Add("q3", tvwChild, "a3", "a")

End Sub


0
 

Author Comment

by:ilanm
Comment Utility
thank you for your answer, but i meant a dynamic tree where there could be 100 question answers or 3.
0
 
LVL 7

Expert Comment

by:Inteqam
Comment Utility
try this
insert a treeview in a form and paste the following:

Private Sub Form_Load()
Dim n As Node
Dim Count as integer
Dim strKeyq as String
Dim strKeta
Set n = Me.TreeView1.Nodes.Add(, , "root", "root")
' use a counter for the Q's
while there is more questions
   count=count+1
   strKeyq="q"+cstr(Count)
   strKeya="a"+Cstr(Count)
 Set n = Me.TreeView1.Nodes.Add("root", tvwChild, strkeyq, "q")
 Set n = Me.TreeView1.Nodes.Add(strkeyq, tvwChild, strkeya, "a")
wend
End Sub

0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:ilanm
Comment Utility
Inteqam i still get the error msg of object not found.

0
 
LVL 7

Expert Comment

by:Inteqam
Comment Utility
it works will in my PC ,
where the error happens?

0
 
LVL 7

Expert Comment

by:Inteqam
Comment Utility
mis spilled Dim strKeta  
it must be Dim strKeya

try now.

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now