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. Designer - TreeCollection of items which have themselves a collection like treenodecollection causes error when adding items

Designer - TreeCollection of items which have themselves a collection like treenodecollection causes error when adding items

Scheduled Pinned Locked Moved C#
helpdesignquestion
3 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.
  • S Offline
    S Offline
    STW
    wrote on last edited by
    #1

    I'd like to store components in a TreeStructure and wanted to be able to design the TreeStructure within the designer. So I've made a Class Item which itself has a Collection ItemCollection (this is the same like TreeNode which has itself a TreeNodeCollection). This should work and it worked, but: As I add my items and the subitems and want to save with "OK" there is the following error: "Object not set to an instance of an Object" - this happens only, if I add Items to a level higher than two: Item1 SubItem (OK) SubItem (Error when saving) Item2 Item3 ... I do not know which Object is null. Can anyone help me with this problem? Thank a lot! Stefan

    S 1 Reply Last reply
    0
    • S STW

      I'd like to store components in a TreeStructure and wanted to be able to design the TreeStructure within the designer. So I've made a Class Item which itself has a Collection ItemCollection (this is the same like TreeNode which has itself a TreeNodeCollection). This should work and it worked, but: As I add my items and the subitems and want to save with "OK" there is the following error: "Object not set to an instance of an Object" - this happens only, if I add Items to a level higher than two: Item1 SubItem (OK) SubItem (Error when saving) Item2 Item3 ... I do not know which Object is null. Can anyone help me with this problem? Thank a lot! Stefan

      S Offline
      S Offline
      Stanciu Vlad
      wrote on last edited by
      #2

      I know my answer is not what you expected, but if you have a IDE you can go step by step into the code and find out why it doesn`t work. Your problem may come form a bad code line, or a wrong condition. I hope you understand...

      S 1 Reply Last reply
      0
      • S Stanciu Vlad

        I know my answer is not what you expected, but if you have a IDE you can go step by step into the code and find out why it doesn`t work. Your problem may come form a bad code line, or a wrong condition. I hope you understand...

        S Offline
        S Offline
        STW
        wrote on last edited by
        #3

        Thank you for your answer. I design the Collection in the Form-Designer, so Debugging is not possible. The problem is that I cannot see what the Designer wants to code because the designer tries to put code and cannot because the code would be wrong, so I can't see what the designer want to write. Thanks Stefan

        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