Reference a component at runtime

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime. From
what I understand I should use Reflection to do this, but I have never used
Reflection and not sure where to begin.... Could somebody point me in the
right direction?
 
You do not need Reflection to access a component's properties. When you
dropped it onto the component tray it was given a name. Let's say it was
named Componet1. If the property is named Text then to access the property
in code you would type ...

Componet1.Text

Have fun

Robby
 
You are right... I don't know what I was thinking! DOH!
Its been a long day... I am going home.

Thanks
 
cOdEmOnKeY said:
I have created a component that I add to the component tray at Design time.
I need to know how to access a property on this component at Runtime.
From
what I understand I should use Reflection to do this

Placing the component on the form will create a private variable holding a
reference to the component's instance. So, if you place a
'System.Windows.Forms.Timer' on your form, which is apparently a component,
and its name is set to 'Timer1', you can access the component using the
variable 'Timer1' inside the form/... you placed the component on.
 
Back
Top