Finding the parent of a control

Discussion in 'Questions (Windows Mobile)' started by willisgt, Feb 15, 2008.

  1. willisgt

    willisgt Active Member Licensed User

    I'm back into my wacky ways of creating controls on the fly; I'm placing buttons, lablels, and such on panels which are created at runtime.

    Is there a method for determining the name of the panel that a given control is on? I was hoping for Control( name ).Parent, but no such luck...

  2. agraham

    agraham Expert Licensed User

    Why not keep track of them as you add, and maybe change parent, using a Hashtable or SortedList from my collections library
  3. willisgt

    willisgt Active Member Licensed User

    I was actually thinking of just adding a table to the form, and storing the control name along with its parent. Just looking for a simpler solution.

  4. Erel

    Erel Administrator Staff Member Licensed User

    Maybe you can use GetControls which returns the sons of a specific control.