First, please look at this custom Button-inherited UserControl code:
Public Class UserControl1
Dim _Text As String
Dim _Image As Image
<Browsable(True), Description("Gets or sets the text displayed on the button")> _
Overrides Property Text() As String
Get
Return _Text
End Get
Set(ByVal value As String)
_Text = value
MyBase.Text = value
End Set
End Property
<Browsable(True), Description("Gets or sets the image displayed on the button")> _
Overloads Property Image() As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
_Image = value
'ReDrawMe()
End Set
End Property
End Class
That's ALL the code of the UserControl. The Overrides
at Text
property is OK, but I don't know why VS tell me I CAN'T use Overrides
at Image
property, but I can use Overloads
. Why? I thought Overloads
only use if there're multiple methods with the same name (different parameters). Two things I still doubt:
- Why
Image
is the only property declaration in this class, but it must be calledOverloads
? - The
Property
doesn't have any parameter (of course), so how couldOverloads
possible?
Thanks for reading.