Tech Off Thread

2 posts

Getting at the Parent of a Component

Back to Forum: Tech Off
  • User profile image
    Gimped

    I have a custom componet (inherets from System.ComponentModel.Componet) and I am trying to find the Type of the Container to this component. I wasn't sure what to use, so I tried the Container property and the Site property and neither gave me anything when I called GetType().

    My component has a string property that defines an event in the parent. Once I know what the event is, I want to wire up an EventHandler in my component to the event specified in the property.

    If someone can help me, I would really appreciate it. I have been stuck on this for a while.

    -Gimped

  • User profile image
    GooberDLX

    Container and Site should give you something, even if its null.. GetType().ToString(); try that and see what has been given.. then on that, cast your sender object of the event as that type and you can utilize it.

    Jake

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.