Help me with Tree View and TextBox [modified]
-
I'm coding a program like this in .Net 3.0. When you load a XML data. Its elements, texts, attributes will be populated on the Tree View and its full content in Text Box. I used XDocument(System.Xml.Linq) to make it faster. But now When I select a node from the Tree View, I want to highlight the line of XML code in the Text Box which contain that node. Any solution for this ? Help me, pls. Thank you.
modified on Friday, May 16, 2008 2:01 AM
-
I'm coding a program like this in .Net 3.0. When you load a XML data. Its elements, texts, attributes will be populated on the Tree View and its full content in Text Box. I used XDocument(System.Xml.Linq) to make it faster. But now When I select a node from the Tree View, I want to highlight the line of XML code in the Text Box which contain that node. Any solution for this ? Help me, pls. Thank you.
modified on Friday, May 16, 2008 2:01 AM
Personally I would make a class that inherits from TreeNode and store the corresponding XML Code in it. When you select this TreeNode you can search in the Textbox for that string an highlight it. Hope this helps
Tiefe Brunnen muss man graben wenn man klares Wasser will, tiefe Wasser sind nicht still.
-
Personally I would make a class that inherits from TreeNode and store the corresponding XML Code in it. When you select this TreeNode you can search in the Textbox for that string an highlight it. Hope this helps
Tiefe Brunnen muss man graben wenn man klares Wasser will, tiefe Wasser sind nicht still.
-
Thanks for your help. I thought about it and I found one problem. If two element has the exact name, attribute and text. How can I distinguish between them. I don't know how to store and retrieve their full path. Can you make an example for me :)
If two elements have the same name, you can distinguish it by the order of the elements. Have these elements the same parent? I could only give you an example with the standard XmlDocument object. With linq i didn't handle that problem yet. Tryout the XmlNotepad from MS, may this gives you an idea, how you can handle the Xml.
Der Staat mit der niedrigsten Geburtenrate ist nicht die Bundesrepublik, sondern der Vatikan.
-
If two elements have the same name, you can distinguish it by the order of the elements. Have these elements the same parent? I could only give you an example with the standard XmlDocument object. With linq i didn't handle that problem yet. Tryout the XmlNotepad from MS, may this gives you an idea, how you can handle the Xml.
Der Staat mit der niedrigsten Geburtenrate ist nicht die Bundesrepublik, sondern der Vatikan.