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. Tag Property References?

Tag Property References?

Scheduled Pinned Locked Moved C#
c++data-structureshelpquestion
1 Posts 1 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.
  • T Offline
    T Offline
    Tym
    wrote on last edited by
    #1

    I have Class A with Properties Foo and Bar and Class B which has an indexer to an Array of Class A objects. I have a button for each element in B's array of A's. I want to refer to these A objects through the Tag property of each button: private B b = new B(2); // contructs array[2] of Class A objects, but both are null button1.Tag = b[0]; button2.Tag = b[1]; I think my problem lies in the fact that many times the elements in the array will be null, which leaves the tags as null. I would like the tag, however, to refer to the space in the array in the Class B object, so I can do something like : (A)button1.Tag = new A(FOO, BAR); thereby creating a new Class A object within b's array. Along with this I would like to be able to set the properties like: ((A)button2.Tag).Foo = NEWFOO; I come from C++ so I always think in pointers. Do I need pointers to do this, or just a different approach? Tym!

    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