|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Initialize DefaultPropertyAttribute for a Object propertyDoes 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. 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: Show quoteHide quote > 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. >
Show quote
Hide quote
"Theo Verweij" wrote: Thanks for your answer. I will assume for now that is the only way to do it > 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) > > as I have not found any other way.
This mail sending code snippet does not work
incorrect string format Altering a DBF File Fundamental OOP inheritance question Accessing an arraylist from multiple forms. Examples of VB.net commercial software packages Visual Basic 2003 won't run - get error message Dynamically changing button label from a variable Resource File Woes Do I need to reset the cursor or will that happen automatically when I leave the subroutine? |
|||||||||||||||||||||||