|
-
Aug 15th, 2006, 04:37 AM
#1
Thread Starter
Frenzied Member
[2.0] Issue on sorting a treeview.
I loaded hundreds of data in treeview w/ child nodes and I want it to be sorted but the problem occur when I used the sort() property of the treeview the child nodes get lost. Any one same issue with this?
btw Is it advisable to load a bunch of data in treeview for the sake of easy browsing or not?
My next option is just used combobox.
-
Aug 15th, 2006, 05:55 PM
#2
Fanatic Member
Re: [2.0] Issue on sorting a treeview.
If your going next attempt is with a combo box then wouldn't a list box be good enough instead of a tree view? And no, I've never heard of nodes disappearing when you call Sort(). How are you loading data into the treeview?
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Aug 15th, 2006, 07:08 PM
#3
Thread Starter
Frenzied Member
Re: [2.0] Issue on sorting a treeview.
Actually the data has a heirarchy that's why I used treeview. I just loop to populate my treeview. If you populate a treeview w/ a hundred's of data and call the sort property the child nodes disappear. I don't know maybe it's a bug or i'm the bug.
-
Aug 15th, 2006, 10:11 PM
#4
Fanatic Member
Re: [2.0] Issue on sorting a treeview.
Well I opened a brand new project and put a TreeView and Button on the form and here is the complete code I used:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace TreeViewTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (int i = 0; i < 20; i++)
{
TreeNode node1 = treeView1.Nodes.Add(i.ToString());
for (int j = 0; j < 10; j++)
{
TreeNode node2 = node1.Nodes.Add(j.ToString());
for (int k = 0; k < 3; k++)
{
node2.Nodes.Add(k.ToString());
}
}
}
}
private void button1_Click(object sender, EventArgs e)
{
treeView1.Sort();
}
}
}
It loaded the tree correctly, and after I pressed the button it sorted everything and every single node was still there. So, what are the differences between this example and your project?
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
-
Aug 15th, 2006, 11:24 PM
#5
Thread Starter
Frenzied Member
Re: [2.0] Issue on sorting a treeview.
Try to add up to 500 data in your nodes then call the sort property and tell me if its ok.
-
Aug 16th, 2006, 06:06 PM
#6
Fanatic Member
Re: [2.0] Issue on sorting a treeview.
I think you should create your own separate test projects and run your own tests.
The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|