Uncheck child nodes if parent node is unchecked in treeview

J

Jonathan Brown

I'm trying to use a Treeview control. I'd like to have all child nodes be
automatically unchecked if a if I uncheck a parent node. Also, is there a
way to specify that if a node contains child nodes it'll automatically be
bold?

I've got drag 'n drop working on my treeview and so I'd like any parent
nodes to bold themselves.

I would love it if someone could help me with this. Even better; does
anyone know a really, really good and simple to understand novice to advanced
tutorial on how to program treeview controls? This would help prevent me
from bugging everyone about my treeview woes.
 
S

st

1. You need to iterate the collection of children of the node being unchecked and uncheck each of them individually.

2. Yes, of course. 'Or' TVIS_BOLD constant to item style when adding it's children. Check Object Browser ([F2] key in VB) to see VB equivalents of TVM_SETITEM message (probably some method of TreeNode(?) object) and TVIS_BOLD constant (=&h10=16).
 
J

Jonathan Brown

Could you explain a little more about your number 2 line? Is that supposed
to make any parent node bold if it contains child nodes? How would I use
that? Which event would I put that in?

st said:
1. You need to iterate the collection of children of the node being unchecked and uncheck each of them individually.

2. Yes, of course. 'Or' TVIS_BOLD constant to item style when adding it's children. Check Object Browser ([F2] key in VB) to see VB equivalents of TVM_SETITEM message (probably some method of TreeNode(?) object) and TVIS_BOLD constant (=&h10=16)
 

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

Top