By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,064 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,064 IT Pros & Developers. It's quick & easy.

Unable to set Default value for UserControl property

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

Dim m_bBrowseRole as Boolean = True

Ken
------------------
"Atchoum" <NO************@videotron.ca> wrote in message
news:Q_********************@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

Nov 20 '05 #2

P: n/a
* "Atchoum" <NO************@videotron.ca> scripsit:
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")> _
\\\
Private m_bBrowseRole As Boolean = True
///
Property ShowBrowseRole() As Boolean

Get
Return m_bBrowseRole
End Get

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


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #3

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

Nov 20 '05 #4

P: n/a
* "Atchoum" <NO************@videotron.ca> scripsit:
Thanks for your response. I know I can do it this way.
But is this to mean that ComponentModel.DefaultValue does not work properly?


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/>
Nov 20 '05 #5

P: n/a
Thanks for the explanation. I misinterpreted what I read somewhere then. I
really appreciate it.
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.