473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Initialize DefaultPropertyAttribute for a Object property

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
2 1370
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

74
by: Peter | last post by:
Hi, So many times, I have seen compile warning: "you used a char* without initilize it", probably on the code like this: ------------ char* ptr; func(..., ptr); ----------
2
by: ksskumar2000 | last post by:
Hi, I have added following two reference under COM tab, Microsoft Office 11.0 Object Library Microsoft Word 11.0 Object Library The software I have used: Visual studio 1.14 Microsoft Office...
15
by: Geoff Cox | last post by:
Hello, Can I separately declare and initialize a string array? How and where would I do it in the code below? It was created using Visual C++ 2005 Express Beta 2 ... In C# I would have ...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
1
by: Pietro | last post by:
Hi, I've created this control to hold name and template: <Controle Id="ctrl" Nome="Header"> <Template> Bla Bla ..... </Template> </Controle> But i want to set the Template property as...
0
by: juststarter | last post by:
Hello all, here is my problem. I am using a property grid control (in a vb.net 2003 project) in which two properties are exposed : "editorStyle" and "events". The first property is used to select...
22
by: silversurfer2025 | last post by:
Hello everybdy, I am a little confused for the following reason: In my code I used a simple for-loop in order to initialize a 2D-array of floats to zero. Because of efficiency reasons, I changed...
14
by: 2005 | last post by:
If a Constructor can be used to initialize, when is memory is allocated / say the "new" operator etc? Thanks
2
by: SparkPlug | last post by:
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.: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.