Re: defaultValueAttribute
From: Mike G. (theNOSPAMjunkbox_at_comcast.net)
Date: 10/22/04
- Next message: Scott Allen: "Re: Each time I do a postback, another copy of a control is added to the page!"
- Previous message: Simon Harvey: "Each time I do a postback, another copy of a control is added to the page!"
- In reply to: Jorge Matos: "RE: defaultValueAttribute"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 22 Oct 2004 10:08:44 -0400
Thanks Jorge,
I created a new web control library project to test this. I had one
property that did not specify the defaultvalue attribute, but gave the
property a default value by assigning a value to the private variable. That
value correctly displayed in the IDE. I then added the defaultvalue
attribute and assigned it a different value. There was no change in the
IDE. Am I missing something?
Mike
"Jorge Matos" <JorgeMatos@discussions.microsoft.com> wrote in message
news:983110A0-3B6E-45A8-8F83-CD06268C5CAE@microsoft.com...
> Its an attribute that the VS.NET IDE looks at when displaying your custom
> property in the properties window. If the attribute is found, the
> designer
> will display your property with the value specified by the attribute.
>
> "Mike G." wrote:
>
>> I have a dumb question: What does the defaultvalue attribute do?
>>
>> The help system says that it "Specifies the default value for a
>> property",
>> and provides the following as an example:
>>
>> Private MyVar as Boolean = False
>> <DefaultValue(False)> _
>> Public Property MyProperty() As Boolean
>> Get
>> Return MyVar
>> End Get
>> Set
>> MyVar = Value
>> End Set
>> End Property
>>
>> It seems to me that MyProperty has a default value of false because of
>> the
>> first line:
>> Private MyVar as Boolean = False
>>
>> So, what exactly does DevaultValue(False) do?
>>
>> Thanks!
>>
>> Mike
>>
>>
>>
- Next message: Scott Allen: "Re: Each time I do a postback, another copy of a control is added to the page!"
- Previous message: Simon Harvey: "Each time I do a postback, another copy of a control is added to the page!"
- In reply to: Jorge Matos: "RE: defaultValueAttribute"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|