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 8167387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:10:38+00:00 2026-06-06T20:10:38+00:00

The tree-view is loaded with some data from a DB. I want to filter

  • 0

The tree-view is loaded with some data from a DB. I want to filter tree-view for the selected combo-box item. Anybody show me how to perform this?

 public SelectorDataTreeView()
        {            
            InitializeComponent();

            button1.FlatStyle = FlatStyle.Flat;

            comboBox1.Items.Add("HP");
            comboBox1.Items.Add("DELL");
            comboBox1.Items.Add("Cam");

        }






        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
           String s = comboBox1.SelectedItem.ToString();
           ExpandAll(MyTreeView.Nodes);
        }




        //TreeKey Finder
        private TreeNode[] FindNode(String searchKey)
        {

            return MyTreeView.Nodes.Find(searchKey, true);

        }
}
  • 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-06-06T20:10:41+00:00Added an answer on June 6, 2026 at 8:10 pm
    private void Form4_Load(object sender, EventArgs e)
        {
            treeView1.Nodes.Add("LaptopsNodeKey", "Laptop");
            treeView1.Nodes.Add("CellPhonesNodeKey", "Phones");
            treeView1.Nodes.Find("LaptopsNodeKey", true)[0].Nodes.Add("DellTM", "Dell");
            treeView1.Nodes.Find("LaptopsNodeKey", true)[0].Nodes.Add("SonyTM", "Sony");
            treeView1.Nodes.Find("CellPhonesNodeKey", true)[0].Nodes.Add("HTCTM", "HTC");
            treeView1.Nodes.Find("CellPhonesNodeKey", true)[0].Nodes.Add("NokiaTM", "Nokia");
    
            comboBox1.Items.Add("LaptopsNodeKey");
            comboBox1.Items.Add("CellPhonesNodeKey");
    
            comboBox2.Items.Add("Laptop");
            comboBox2.Items.Add("Phones");
        }
    
        //This works because you Loaded ComboBox1 with Name property of Nodes
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            treeView1.CollapseAll();
            treeView1.SelectedNode = treeView1.Nodes.Find(comboBox1.Text, true)[0];
            treeView1.SelectedNode.Expand();
        }
    
        //This doesn't work, because you Loaded ComboBox2 with Text property of Nodes
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            treeView1.CollapseAll();
            treeView1.SelectedNode = treeView1.Nodes.Find(comboBox1.Text, true)[0];
            treeView1.SelectedNode.Expand();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a treeview data loaded from a XML file. I want to perform
I have a hypothetical tree view that contains this data: RootNode Leaf vein SecondRoot
I've got a tree view that can be anywhere from 1 level deep to
I want to configure the tree view component so that would be the topmost
I'm working on a JavaScript dynamically loaded tree view user control. I'd like to
Is there any way to view XAML tree loaded into a browser? We are
I have a tree view <asp:TreeView ID=TreeView1 runat=server DataSourceID=SiteMapDataSource1 ShowExpandCollapse=False> </asp:TreeView> As you can
I have a tree view defined as follows: <HierarchicalDataTemplate x:Key=ChildTemplate ItemsSource={Binding Children}> <TextBlock Text={Binding
I have a tree view representing certain items. This tree is always two levels
i have an ASP tree view having a Node so now, i have to

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.