Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help me with Tree View and TextBox [modified]

Help me with Tree View and TextBox [modified]

Scheduled Pinned Locked Moved C#
csharplinqdata-structuresxmlhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kissmevn
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • K kissmevn

      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

      S Offline
      S Offline
      sunspeed
      wrote on last edited by
      #2

      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.

      K 1 Reply Last reply
      0
      • S sunspeed

        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.

        K Offline
        K Offline
        kissmevn
        wrote on last edited by
        #3

        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 :)

        S 1 Reply Last reply
        0
        • K kissmevn

          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 :)

          S Offline
          S Offline
          sunspeed
          wrote on last edited by
          #4

          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.

          K 1 Reply Last reply
          0
          • S sunspeed

            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.

            K Offline
            K Offline
            kissmevn
            wrote on last edited by
            #5

            Thank you, I will give it a shot

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups