Thanks Ken. I'll be doing it your way in the future. I experimented
a bit and it doesn't seem to hurt to use ...
Dim mintAge As Int32 = 5
<Description("AgeP (in days)"), _
' DefaultValue(5)> _
Property Age() As Int32 ...
but what's the point? That's not just a remark. I am curious as to
what Description and DefaultValue attributes are used for? I can find
no documentation on these attributes.
Also learned that if I code ...
Dim mintAge As Int32 = 5
<Description("AgeP (in days)"), _
' DefaultValue(6)> _ ' < - NOTE 6 not 5
Property Age() As Int32 ...
Visual Studio still reports that the default is 5.
Thanks again for your help.
Bob
On Mon, 27 Sep 2004 14:52:23 -0400, "Ken Tucker [MVP]"
[quoted text, click to view] <vb2ae@bellsouth.net> wrote:
>Hi,
>
> This is how i would do it.
>
>Dim mintApeP as integer = 5
>
> Property AgeP() As Int32
> Get
> Return mintAgeP
> End Get
> Set(ByVal Value As Int32)
> mintAgeP = Value
> End Set
> End Property
>
>Ken
>----------------
>"eBob.com" <eBob.com@totallyfakeisp.com> wrote in message
>news:jlkgl01hh24hmle55rabvjk7nh35q67pa9@4ax.com...
>I've created a User Control and given it a property using the folloing
>code ...
>
> <Description("AgeP (in days)"), _
> DefaultValue(5)> _
> Property AgeP() As Int32
> Get
> Return AgeP
> End Get
> Set(ByVal Value As Int32)
> AgeP = Value
> End Set
> End Property
>
>
>Note that the DefaultValue is 5. But when I drag my UserControl onto
>a form the default value for AgeP (under Misc.) shows up as 0. Is
>there something wrong with my code?
>
>Thanks, Bob
>
[quoted text, click to view] "eBob.com" <eBob.com@totallyfakeisp.com> wrote in message
news:dpdhl0dknag3k18vbkakkfrhlni3nd6cp3@4ax.com...
>
> Dim mintAge As Int32 = 5
> <Description("AgeP (in days)"), _
> ' DefaultValue(5)> _
> Property Age() As Int32 ...
>
> but what's the point? That's not just a remark. I am curious as to
> what Description and DefaultValue attributes are used for? I can find
> no documentation on these attributes.
The Description Attribute sets the text that is shown in the pane below the
Property editor when the property is selected.
The DefaultValue Attribute assigns a value which will be applied on Reset of
the property in the property editor. You should also notice that when the
Value is not 5 then it will be Bold in the property editor and will be
serialized in the InititializeComponent() method.
[quoted text, click to view] >
> Also learned that if I code ...
>
> Dim mintAge As Int32 = 5
> <Description("AgeP (in days)"), _
> ' DefaultValue(6)> _ ' < - NOTE 6 not 5
> Property Age() As Int32 ...
>
> Visual Studio still reports that the default is 5.
>
This results in the Initial Value being 6, but the Default Value is 5. Right
Click on the property in the Property Editor and choose reset and you wil
see that the value is set to 5 and is not shown in Bold.
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html ---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Thank you very much Mick. I hadn't noticed the text in the pane below
the Property editor because I had its size squeezed down to
practically nothing. I can't imagine any reason for wanting Reset to
give a property a different value than its original default. But I am
REAL new to this stuff.
Thanks again for your help.
Bob
On Tue, 28 Sep 2004 07:16:23 +0100, "Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
[quoted text, click to view] wrote:
>
>"eBob.com" <eBob.com@totallyfakeisp.com> wrote in message
>news:dpdhl0dknag3k18vbkakkfrhlni3nd6cp3@4ax.com...
>>
>> Dim mintAge As Int32 = 5
>> <Description("AgeP (in days)"), _
>> ' DefaultValue(5)> _
>> Property Age() As Int32 ...
>>
>> but what's the point? That's not just a remark. I am curious as to
>> what Description and DefaultValue attributes are used for? I can find
>> no documentation on these attributes.
>
>The Description Attribute sets the text that is shown in the pane below the
>Property editor when the property is selected.
>
>The DefaultValue Attribute assigns a value which will be applied on Reset of
>the property in the property editor. You should also notice that when the
>Value is not 5 then it will be Bold in the property editor and will be
>serialized in the InititializeComponent() method.
>
>>
>> Also learned that if I code ...
>>
>> Dim mintAge As Int32 = 5
>> <Description("AgeP (in days)"), _
>> ' DefaultValue(6)> _ ' < - NOTE 6 not 5
>> Property Age() As Int32 ...
>>
>> Visual Studio still reports that the default is 5.
>>
>This results in the Initial Value being 6, but the Default Value is 5. Right
>Click on the property in the Property Editor and choose reset and you wil
>see that the value is set to 5 and is not shown in Bold.
Don't see what you're looking for? Try a search.