By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Initialize DefaultPropertyAttribute for a Object property

P: n/a
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.

Nov 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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)
SparkPlug wrote:
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.
Nov 5 '06 #2

P: n/a
"Theo Verweij" wrote:
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)
SparkPlug wrote:
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)
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.

Nov 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.