Passing a TreeView control around

S

Swimminschrage

I'm trying to pass a TreeView control to a public global method to populate
the tree with data from the DB.

Here's the call I make from the Form Load:

Private Sub Form_Load()
'Load the tree according to information in the database
Call treeInit(Me.treeBranches, "SELECT parentId FROM Branches WHERE
parentId = ")
End Sub

Here's the function definition for treeInit():

Public Sub treeInit(ByRef tree As TreeView, qry As String)

treeBranches is the name of the TreeView control that I'm trying to pass
around, but I keep getting a "Type Mismatch" error when I run the code.

Inside of the treeInit method, I'm trying to recursively create the tree by
passing Node objects around (not TreeNodes). Is this allowed? How do I create
a brand new node to store the current value that the recursive call is
working on?

Thanks,

Andy
 
G

Graham Mandeno

Hi Andy

The TreeView object is referenced by the Object property of the control, not
the control itself. So try this:

Call TreeInit(Me.treeBranches.Object, "Select...")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top