Miguel,
If you are sure that the property will be a control can you change the
Property definition to something more like this:
Public Property myControl() As Control
Get
End Get
Set(ByVal value As Control)
End Set
End Property
Using 'control' as a property name might be confusing....
So then after you add this control, you want to add a literal, so what
about something like this
Private _myControl As Control
Public Property myControl() As Control
Get
Return _myControl
End Get
Set(ByVal value As Control)
_myControl = value
End Set
End Property
Public Sub addLiteral()
Dim myLiteral As Literal
Me.myControl.Controls.Add(myLiteral)
End Sub
I'm a newbie, so I may be off the mark, but does this help?
Kathryn
shapper wrote:
Hi,
I need to pass an object to a class which can represent a panel, a
label, or some other control. I did as follows:
Private _Control As Object
Public Property Control() As Object
Get
Return _Control
End Get
Set(ByVal value As Object)
_Control = value
End Set
End Property ' Control
Now, some how, inside my class, I need to add a literal control to this
control as a child.
Something like:
Me.Control.(Add Literal)
How can I do this?
Thanks,
Miguel
kbutterly wrote:
Miguel,
Just to clarify: Are you asking how to define a property in a class
that is a control? or how to assign a control to a property in a class
that has been defined as a control?
Kathryn
shapper wrote:
Hello,
>
How can I send a control to a class as a property?
I don't know which control it would be. It could be a panel, a label
...
>
Thanks,
Miguel