Initialize DefaultPropertyAttribute for a Object property

G

Guest

Does anyone know how to initialize a DefaultPropertyAttribute for a
object-type property, for example if you want to set the default value of a
Font property to a particular font? E.g.:

<DefaultValue(...)> _
Public Property HeaderFont() As Font
Get
Return _headerFont
End Get
Set(ByVal value As Font)
_headerFont = value
End Set
End Property

....where I want to set the default value for the HeaderFont property to
something like Font("Arial", 16, FontStyle.Bold)

Many thanks.
 
T

Theo Verweij

How to do it with an attribute, I don't know.
But initialising a default property value is quite simple:

Private _headerFont as font = new Font("Arial", 16, FontStyle.Bold)
 
G

Guest

Theo Verweij said:
How to do it with an attribute, I don't know.
But initialising a default property value is quite simple:

Private _headerFont as font = new Font("Arial", 16, FontStyle.Bold)

Thanks for your answer. I will assume for now that is the only way to do it
as I have not found any other way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top