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. "Find" name or value of property in Property Grid (property grid is tree structure)

"Find" name or value of property in Property Grid (property grid is tree structure)

Scheduled Pinned Locked Moved C#
helpcssdata-structures
5 Posts 4 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
    kashme
    wrote on last edited by
    #1

    Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.

    F L 2 Replies Last reply
    0
    • K kashme

      Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      You would start by going back over your class notes to see how the instructor has taught you to do it. Then you make an attempt at your own homework. When that fails, show us what you have done and we'll walk you through the solution. Cheers.

      I wasn't, now I am, then I won't be anymore.

      K 1 Reply Last reply
      0
      • F fjdiewornncalwe

        You would start by going back over your class notes to see how the instructor has taught you to do it. Then you make an attempt at your own homework. When that fails, show us what you have done and we'll walk you through the solution. Cheers.

        I wasn't, now I am, then I won't be anymore.

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

        Maybe I did not explained the question properly. I am not a beginner n C# :^) i am not looking for answer a.B.C.x etc to access the value. I want the answer in tree and propertygrid perspective. I have a form with tree structure on left side and property grid on right side. When I load the form by adding object A to tree structure I can see the properties in propertygrid on right hand side, that is fine. I can see B,C and x,y,z and I can modify it. That is fine too. Now I want to add a menu option like visual studio "Find" to find the name or value based on the search condition. So in my example I want to search name "x" in the tree. The output should highlight x and show its value in the property grid. I tried to use propertydescriptor to get properties of A, so it gives me I have property B but how can I access class C and its property dynamically. Let me know if my problem is not clear.

        S 1 Reply Last reply
        0
        • K kashme

          Consider a larger picture. Suppose I have class A,B,C. Class A contains property B and class B contains property C and class C have some properties. How will I access properties of C. I need to know a generic solution. Now suppose I start from A as rootNode in tree structure and propertyGrid.SelectedObject = A, how will I access properties of class C. In real world context suppose I need to find "x" using property grid and tree structure. The output should highlight x and its value in propertygrid. sample code:: Class A { B b { get; set;} } Class B { C c { get; set;} } Class C { int x { get; set;} float y { get; set;} string z { get; set;} } int main() { A a = new A(); propertyGrid.SelectedObject = a; } How will I access x,y,z name and value using propertygrid. I am stuck here, please help.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          This[^] should help you. Go to the 'Support for Custom Types' section.

          1 Reply Last reply
          0
          • K kashme

            Maybe I did not explained the question properly. I am not a beginner n C# :^) i am not looking for answer a.B.C.x etc to access the value. I want the answer in tree and propertygrid perspective. I have a form with tree structure on left side and property grid on right side. When I load the form by adding object A to tree structure I can see the properties in propertygrid on right hand side, that is fine. I can see B,C and x,y,z and I can modify it. That is fine too. Now I want to add a menu option like visual studio "Find" to find the name or value based on the search condition. So in my example I want to search name "x" in the tree. The output should highlight x and show its value in the property grid. I tried to use propertydescriptor to get properties of A, so it gives me I have property B but how can I access class C and its property dynamically. Let me know if my problem is not clear.

            S Offline
            S Offline
            Subin Mavunkal
            wrote on last edited by
            #5

            I want the answer in tree and propertygrid perspective. ???

            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