Miguel,
As i mentioned in one of my replies to earlier topic sent by you, if you
need to expose a property based on existing instance, and you just want to
change instance's properties not reference itself, apply readonly properties:
public readonly property MyButton() as Button
get
return me._myButton ' return existsing instance
end get
end property
If i added set property i would be possible to replace existing control with
another instance which we don't want to. Note we are interested in changing
internal button's properties, for instance:
myUserControl.MyButton.PropertyToSet = "newvalue"
not assigning to different button (it would be possible if I exposed set
property):
myUserControl.MyButton = new Button()
I have already replied to rest of the topic in your later post here:
http://www.microsoft.com/communities...1-3ab5b5eb90be
Hope it's clear now
Regards
--
Milosz
"shapper" wrote:
Hello,
I am creating a user control where an Asp.Net control is used. It can
be either a button, an image button or a label.
I am trying to "expose" the Asp.Net control properties and events in
the page where the user control is used.
For that I defined a property as follows:
Private _Control As Control
Public Property Control() As Control
Get
Return _Control
End Get
Set(ByVal value As Control)
_Control = value
End Set
End Property ' Control
The problem is that the type of control that the User Control will
create and use depends of another User Control named property.
So, should I create 3 properties in my User Control of the 3 different
types: Button, ImageButton and Label?
Thanks,
Miguel