Thursday, March 13, 2008

My Treeview Project

Treeviews are really powerful interface components. I love building with them. They aren't easy to get started with, though, for a few reasons: they can't be bound to data so you have to fill them using VBA code, they're not part of Access and so aren't covered in the Access help (they're ActiveX controls), and they are often used with complex data, such as hierarchical relationships.

I see lots of questions on the web asking "How do I get started with treeviews- is there a tutorial?". My Treeview Project is just that- a tutorial. Seasoned VBA developers may find it goes a little slow, but be patient! It's aimed at folk for whom the Microsoft online references aren't enough. It goes step-by-step, starting with a simple "Hello World" treeview.

Here's the current table of contents.

Subscribe to My Treeview Project in a feed reader!

7 comments:

Anonymous said...

What an excellent tutorial. Superb! Easy to follow, useful and descriptive. They don't come any better!

randfb said...

Thanks for sharing this tutorial.

I would like to use a Tree Control to let users choose a record to edit in a form and also to right click on the tree to add a new record.

I can't find any examples of doing the right click, context menu, add record.

Can anyone help ?

MartyO said...

I'm attempting to follow your tutorial using Access 2007 and am getting an undefined variable error on 'tvwChild' in the second episode. Any thoughts on how to resolve this error?

Stephen said...

MartyO: tvwChild is a constant that you get from the reference to MsComctllib. Access hould have added this reference to your database when you added the treeview to your form.

MartyO said...

Your tutorial has been of great assistance to me in creating my first treeview control ... Thanks much.

I'm attempting to set font properties when I build a node. Following your example it seems the syntax should be .font.italic = True. This is in place of your .forecolor=x. Can you point me to documentation on using the font property?

Thanks for any help.

Anonymous said...

hi i loved your site it is really easy to understand ... i would really like to know how it works using c# cause i am trying so hard but not able to do it ... i have a company's product database in which i need to a have a treeview which can have number of parent nodes and each parent node can have one or more than one child node and even child node can have sub nodes .. and whichever node is selected ,it is to reflected in crystal report..

Anonymous said...

you are a wise man. Thank's