rekam Posted October 7, 2003 Posted October 7, 2003 Hello ! I'm a beginner in vb.net and I need a little help. I have a XML file which as this structure : <index> <node> <text>blublu</text> <text>blublu</text> </node> <node> <text>blublu</text> <text>blublu</text> <text>blublu</text> </node> <node> <text>blublu</text> <text>blublu</text> </node> ... </index> Each node represents a root node in the treeview and each text is a child. I would like to put this into the treeview. But it seems a bit complicated. In vb6, it was ok, but with .net...ARGH ! When I put node via the graphic interface, I have that : tvListeParam.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Node", New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("blublu"), New System.Windows.Forms.TreeNode("blublu"), New System.Windows.Forms.TreeNode("blublu")}), New System.Windows.Forms.TreeNode("Node", New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("blublu")})}) Is there a better way than this to create a treeview dynamically ? Thank you ! Quote
AlexCode Posted October 7, 2003 Posted October 7, 2003 I'm really not shure but I thinj this control has more than you ever wanted... http://www.codeproject.com/cs/miscctrl/treelistview.asp Enjoy :D Quote Software bugs are impossible to detect by anybody except the end user.
rekam Posted October 7, 2003 Author Posted October 7, 2003 Ups, it's a bit hard to understand. Maybe I ask a question more easy. In fact, what I would like to do, it's to insert a node where I want. I saw the Insert method "myTreeView.Nodes.Insert()" . But I need an integer which represents the specified location of the new node. I tried, but I can't understand where I can get it...There is a method "mytreeView.Nodes.IndexOf" but I don't understand it (sob)...:( If anyone knows, I will say a big "THANKS" Quote
*Gurus* divil Posted October 8, 2003 *Gurus* Posted October 8, 2003 In .NET, you add children directly to a node, not to the main treeview. You only add top-level nodes to the main treeview. After that, you use the Nodes collection of each node you add. You are correct about using the Insert method if you need to control the position of a node in the list of children, but I don't think that's what you're after. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.