Click here to Skip to main content
12,556,534 members (67,148 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


5 bookmarked

Select only one node in Treeview

, 21 Aug 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Select only one node in Treeview
If you want to check Treeview control's only one node for each root node, you can use this:

private void treeview1_AfterCheck(object sender, TreeViewEventArgs e)
    if (e.Node.Checked)
private void DiselectParentNodes(TreeNode parent)
    while (parent != null)
        if (parent.Checked)
            parent.Checked = false;
        parent = parent.Parent;
private void DiselectChildNodes(TreeNodeCollection childes)
    foreach (TreeNode oneChild in childes)
        if (oneChild.Checked)
            oneChild.Checked = false;


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Vano Maisuradze
Georgia Georgia
No Biography provided

You may also be interested in...


Comments and Discussions

BugNot working code Pin
Martin Křížek6-Jan-16 3:00
memberMartin Křížek6-Jan-16 3:00 
SuggestionFor checking Single node at a time in entire tree Pin
AshishAgrawal12326-Aug-14 20:21
memberAshishAgrawal12326-Aug-14 20:21 
GeneralThis code will uncheck all 'ancestor' nodes of a given TreeN... Pin
BillWoodruff22-Aug-11 14:52
memberBillWoodruff22-Aug-11 14:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161026.1 | Last Updated 21 Aug 2011
Article Copyright 2011 by Vano Maisuradze
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid