Connecting Tech Pros Worldwide Forums | Help | Site Map

Unable to set Default value for UserControl property

Atchoum
Guest
 
Posts: n/a
#1: Nov 20 '05
I have the following property in one UserControl. When I use the control,
the description appears Ok but the default value is stuck at False.
What am I doing wrong?
<System.ComponentModel.DefaultValue(True), _
Description("Indicates whether users with Browse rights should be
displayed")> _
Property ShowBrowseRole() As Boolean

Get
Return m_bBrowseRole
End Get

Set(ByVal Value As Boolean)
m_bBrowseRole = Value
End Set

End Property

TIA



Ken Tucker [MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Unable to set Default value for UserControl property


Hi,

Dim m_bBrowseRole as Boolean = True

Ken
------------------
"Atchoum" <NO_goglus_SPAM@videotron.ca> wrote in message
news:Q_rNc.36906$HM2.287915@wagner.videotron.net.. .
I have the following property in one UserControl. When I use the control,
the description appears Ok but the default value is stuck at False.
What am I doing wrong?
<System.ComponentModel.DefaultValue(True), _
Description("Indicates whether users with Browse rights should be
displayed")> _
Property ShowBrowseRole() As Boolean

Get
Return m_bBrowseRole
End Get

Set(ByVal Value As Boolean)
m_bBrowseRole = Value
End Set

End Property

TIA



Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Unable to set Default value for UserControl property


* "Atchoum" <NO_goglus_SPAM@videotron.ca> scripsit:[color=blue]
> I have the following property in one UserControl. When I use the control,
> the description appears Ok but the default value is stuck at False.
> What am I doing wrong?
> <System.ComponentModel.DefaultValue(True), _
> Description("Indicates whether users with Browse rights should be
> displayed")> _[/color]

\\\
Private m_bBrowseRole As Boolean = True
///
[color=blue]
> Property ShowBrowseRole() As Boolean
>
> Get
> Return m_bBrowseRole
> End Get
>
> Set(ByVal Value As Boolean)
> m_bBrowseRole = Value
> End Set[/color]

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Atchoum
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Unable to set Default value for UserControl property


Thanks for your response. I know I can do it this way.
But is this to mean that ComponentModel.DefaultValue does not work properly?



Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Unable to set Default value for UserControl property


* "Atchoum" <NO_goglus_SPAM@videotron.ca> scripsit:[color=blue]
> Thanks for your response. I know I can do it this way.
> But is this to mean that ComponentModel.DefaultValue does not work properly?[/color]

This attribute is for the designer only. It will add a "Reset" menu
item to the property's context menu in the properties window that will
reset it to the value provided in this attribute.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Atchoum
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Unable to set Default value for UserControl property


Thanks for the explanation. I misinterpreted what I read somewhere then. I
really appreciate it.


Closed Thread