Nathan Sokalski
Usenet Archive
- Joined
- Jul 22, 2003
- Messages
- 1,332
- Reaction score
- 0
I need to specify the default value for a property of a custom control I am making. Normally this would be done as follows:
Private _myprop As String = "My Default Value"
<System.ComponentModel.DefaultValue("My Default Value")> Public Property MyProperty As String Get Return Me._myprop End Get Set(ByVal value As String) Me._myprop = value End Set End Property
However, in my situation I am not using a private variable to store the value. If I understand correctly, the Property -> Sets for any properties specified is the first thing to occur in the control. Is there a way to specify a default value without using the technique I show above? Thanks.
Private _myprop As String = "My Default Value"
<System.ComponentModel.DefaultValue("My Default Value")> Public Property MyProperty As String Get Return Me._myprop End Get Set(ByVal value As String) Me._myprop = value End Set End Property
However, in my situation I am not using a private variable to store the value. If I understand correctly, the Property -> Sets for any properties specified is the first thing to occur in the control. Is there a way to specify a default value without using the technique I show above? Thanks.