Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective Checkboxes with TreeView

Status
Not open for further replies.

SlantyOD

Programmer
Jun 11, 2002
22
CA
Hi all,

Is there anyway to selectively choose which nodes in a treeview have checkboxes? What I'd like to do is have any node that has a child to not have a checkbox and any node that doesn't have a child to have a checkbox.

Thanks in advance,
SlantyOD
 
I don't think so, because the docs say this:

Tree nodes can optionally display a check box. To display the check boxes, set the CheckBoxes property of the TreeView to true. The Checked property is set to true for tree nodes that are in a checked state.

You could fake this by turning checkboxes off for the TreeView, and then using an ImageList to display a fake checkbox when the node is clicked.

If you're ambitious, you could try inheriting from TreeNode and creating your own TreeNode class. I'm not sure how that would interact with the TreeView's GetNodeAt(), GetNodeCount(), etc. methods.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top