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. Custom item list

Custom item list

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • Z Offline
    Z Offline
    Zaegra
    wrote on last edited by
    #1

    Hi, I was wondering: I have an user-control called myUserControl. This control contains items, say myUserControlItems. Now I want to add a property to myUserControl, which contains a list of myUserControlItems. So:

    myUserControl usrctrl = new myUserControl();
    myUserControlItem usritem = new myUserControlItem();
    myUserControl.Items.Add(usritem);

    I can accomplish this by setting the type of the property to myUserControlItem[], but this isn't as dynamic as e.g Listviewitems in a ListView. Can somebody help me out on this one? Greets, Zaegra

    Motivation is the key to software development.

    A J L 3 Replies Last reply
    0
    • Z Zaegra

      Hi, I was wondering: I have an user-control called myUserControl. This control contains items, say myUserControlItems. Now I want to add a property to myUserControl, which contains a list of myUserControlItems. So:

      myUserControl usrctrl = new myUserControl();
      myUserControlItem usritem = new myUserControlItem();
      myUserControl.Items.Add(usritem);

      I can accomplish this by setting the type of the property to myUserControlItem[], but this isn't as dynamic as e.g Listviewitems in a ListView. Can somebody help me out on this one? Greets, Zaegra

      Motivation is the key to software development.

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      A property of type List<myUserControlItem> may suite your needs.

      There's nothing left in my right brain and nothing right in my left brain.

      1 Reply Last reply
      0
      • Z Zaegra

        Hi, I was wondering: I have an user-control called myUserControl. This control contains items, say myUserControlItems. Now I want to add a property to myUserControl, which contains a list of myUserControlItems. So:

        myUserControl usrctrl = new myUserControl();
        myUserControlItem usritem = new myUserControlItem();
        myUserControl.Items.Add(usritem);

        I can accomplish this by setting the type of the property to myUserControlItem[], but this isn't as dynamic as e.g Listviewitems in a ListView. Can somebody help me out on this one? Greets, Zaegra

        Motivation is the key to software development.

        J Offline
        J Offline
        Jimmanuel
        wrote on last edited by
        #3

        use a list instead of an array: List<myUserControlItem> abc = new List<myUserControlItem>(); myUserControlItem usritem = new myUserControlItem(); abc.Add(usritem); :badger:

        1 Reply Last reply
        0
        • Z Zaegra

          Hi, I was wondering: I have an user-control called myUserControl. This control contains items, say myUserControlItems. Now I want to add a property to myUserControl, which contains a list of myUserControlItems. So:

          myUserControl usrctrl = new myUserControl();
          myUserControlItem usritem = new myUserControlItem();
          myUserControl.Items.Add(usritem);

          I can accomplish this by setting the type of the property to myUserControlItem[], but this isn't as dynamic as e.g Listviewitems in a ListView. Can somebody help me out on this one? Greets, Zaegra

          Motivation is the key to software development.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Zaegra wrote:

          Custom item list

          you call it a list, yet you don't use a List<>? :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Merry Christmas and a Happy New Year to all.


          Z 1 Reply Last reply
          0
          • L Luc Pattyn

            Zaegra wrote:

            Custom item list

            you call it a list, yet you don't use a List<>? :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            Merry Christmas and a Happy New Year to all.


            Z Offline
            Z Offline
            Zaegra
            wrote on last edited by
            #5

            :-O

            Motivation is the key to software development.

            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