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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add checkbox to individual node

Status
Not open for further replies.

EagleTempest

Technical User
Jun 15, 2004
125
0
0
CA
VB 2005, .Net 2

If have the code:
Code:
tnode = New TreeNode(strName)
I don't get the option tnode.showcheckbox?

According to MSDN, this property exists for Treenodes. What am I missing? I want only certain nodes to have checkboxes.
 
ShowCheckBox is a property of the System.Web.UI.WebControls.TreeNode object. I think that you are using the Windows Forms TreeNode, which does not have a ShowCheckBox property.

In a Windows Forms TreeView, you can have either all check boxes showing or none at all, not a mixture. The only way I can think of getting a mixture is to paint the nodes yourself.
 
Thanks. That's exactly the problem. I'm using Windows Forms.
 
For like the 18th time this week I find myself thinking... "Orcas can do that"

I suppose .Net 2/2k5 can do it also, albeit with a bit more work... Okay, a LOT more work.

Easiest solution would probably be to go with a third party tool. The Component One .Net flex grind has a tree view mode, I'm not sure if you could add a boolean column and swap modes then control line by line the visibility of the boolean though. You might be able to find one on Google too.

Or, if you have the time and desire, you can try creating your own. It'll likely involve a bunch of panels, generics, some custom controls, a little GDI+, and a whole lot of headaches.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Hey Rick, I'm running the Beta 2 of Orcas and can't see a way to selectively show checkboxes on nodes in a TreeView (Windows Forms).

Can you point me in the right direction ?
 
I don't know if you can do it directly with the treeview, I'm not sure how the GUI is exposed via the treeview, but using WPF you should be able to add a check box control to a treeview node's GUI component. My hands on time with .Net 3 is somewhat limited, but I've had a chance to check out a decent amount of other peoples work and I know I've seen something very similar.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top