.NET: Sending commands to runtime-created objects

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhyspatto
    New Member
    • Feb 2008
    • 3

    .NET: Sending commands to runtime-created objects

    Hi, I have a problem but cannot figure out a good solution to it.

    I am trying to create a form that creates a bunch of panels during runtime, and I want to be able to send commands (such as false visibility, etc) to the panels also during runtime.

    Once I create a bunch of panels (each using the same 'creation' code), how can I call them up again to send commands to them?
    I figure I can add them to an array and call them using:
    Code:
    arrayObjects(2).visible = false
    etc, but this results in a 'reference/instance' vb error.

    Is this bad coding, or am I missing something completely?

    I seem to remember (i think it was with actionscript 2.0 coding) that you can call objects in this sort of way:

    Code:
    ["panel" & 4].visible = false
    Is there this sort coding option in .NET?
    I can't figure out another method (other than the array one, which isnt working for me anyway) to call a runtime created object, because if I create an panel like so:
    Code:
    dim pnl as new Panel
    pnl.Name = "panel" & i     'for example, i = 3 at this stage, for the 3rd panel
    how to I then call it later on to send commands to it?

    Thankyou, I am still a programming amateur and want to jump this hurdle :-P
Working...