Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6676605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:00:37+00:00 2026-05-26T04:00:37+00:00

i have load a tree view. i want to Traverse treeview node and expand

  • 0

i have load a tree view. i want to Traverse treeview node and expand & select a node. Expand is working fine. but select a node is not working.

private void Traverse(TreeNodeCollection nodes, string findtext) 
        {
          foreach (TreeNode node in nodes) 
            {
                if (node.Text.ToString().Trim() == findtext)
                {
                    node.Expand();
                    node.TreeView.SelectedNode = node.NextNode;                    

                    //tvwStructureTree.SelectedNode = this.tvwStructureTree.Nodes[node.Index];
//Select a node in Treeview tvwStructureTree But not working
                    tvwStructureTree.SelectedNode = node; 
                    node.TreeView.Focus(); 
                }
                Traverse(node.Nodes, findtext); 
            } 

        }

Its in windows application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:00:37+00:00Added an answer on May 26, 2026 at 4:00 am

    Not quite sure what’s your issue is. TreeView.SelectedNode Property is the correct property.

    When you set this property, the specified node is scrolled into view
    and any parent nodes are expanded so that the specified node is
    visible.

    When the parent node or any ancestor node of the selected node is
    collapsed either programmatically or through user action, the
    collapsed node becomes the selected node.

    Make sure that the node.TreeView is the correct TreeView instance.

    node.TreeView.SelectedNode = node.NextNode;  
    

    TreeView.HideSelection Property is another property that might useful for you.

    When this property is set to false, selected nodes in the TreeView
    control remain highlighted in a different color than the current
    selection color when the TreeView control loses focus. You can use
    this property to keep items that are selected by the user visible when
    the user clicks a different control on the form or moves to a
    different window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to select first node of TreeView. But when page loads
I have an architect question: I want to use Tree View to display some
I have a Tree and load it recursively into my TreeView on my form.
I have a tree view control build dynamically. i want to change color of
I have a treeview in wpf and I load it ok is all done
Learning .NET: I have a form with a split container, I want to load
I have a treeview in my masterpage. When a contentpage is loaded i want
I have a Treeview with populateOnDemand set to true. I want this treeview to
I have the following table structure it might not be a correct structure but
I have a little question about my URL . I use a tree view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.