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. UserControl and List

UserControl and List

Scheduled Pinned Locked Moved C#
designdebugginghelp
4 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.
  • M Offline
    M Offline
    Monty2
    wrote on last edited by
    #1

    I have a Usercontrol with a public property List<int> Links

    List<int> Links= new List<int>();
    public List<int> LinkLabels
    {
    get { return Links; }
    set { Links = value; }
    }

    Now when i put it on a dialog and open the properties dialog in design mode i can click the (...) button and it opens up the add items to collection dialog and i can add a few int(s) to the collection but when i click ok and open it up again all entered values are gone :doh: if i set a breakpoint at the set function then the value is empty any help will be greatly appreciated -Thanks

    S M 2 Replies Last reply
    0
    • M Monty2

      I have a Usercontrol with a public property List<int> Links

      List<int> Links= new List<int>();
      public List<int> LinkLabels
      {
      get { return Links; }
      set { Links = value; }
      }

      Now when i put it on a dialog and open the properties dialog in design mode i can click the (...) button and it opens up the add items to collection dialog and i can add a few int(s) to the collection but when i click ok and open it up again all entered values are gone :doh: if i set a breakpoint at the set function then the value is empty any help will be greatly appreciated -Thanks

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

      can you explain it more with code? When You are adding items? in runtime or during the design?

      My small attempt...

      M 1 Reply Last reply
      0
      • S sujithkumarsl

        can you explain it more with code? When You are adding items? in runtime or during the design?

        My small attempt...

        M Offline
        M Offline
        Monty2
        wrote on last edited by
        #3

        during design time through the public properties (in properties tab)


        C++ where friends have access to your private members !

        1 Reply Last reply
        0
        • M Monty2

          I have a Usercontrol with a public property List<int> Links

          List<int> Links= new List<int>();
          public List<int> LinkLabels
          {
          get { return Links; }
          set { Links = value; }
          }

          Now when i put it on a dialog and open the properties dialog in design mode i can click the (...) button and it opens up the add items to collection dialog and i can add a few int(s) to the collection but when i click ok and open it up again all entered values are gone :doh: if i set a breakpoint at the set function then the value is empty any help will be greatly appreciated -Thanks

          M Offline
          M Offline
          Monty2
          wrote on last edited by
          #4

          add

          [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

          to the property being exported


          C++ where friends have access to your private members !

          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