Why does property default value not work?
When i start my application and dont set value from properties window
the value is always "nothing". Whats the point off DefualtValue then?
Regards;
Meelis
Private const cSaveText as string = "Save"
Private const cButtons as string = "Buttons"
<Description("Save button text"), Category(cButtons),
DefaultValue(cSaveText)> _
Public Property SaveButtonText() As String
Get
Return MySaveButtonText
End Get
Set(ByVal value As String)
MySaveButtonText = value
cmbSave.Text = value
End Set
End Property
You need to initialize the variable "MySaveButtonText" as well, since
that is what you are *returning* in the Getter. For string variables, I
believe this is necessary.
Try adding the following line along with the Constant declarations :
---------------------------------------------------------
Private mySaveButtonText As String = cSaveText
---------------------------------------------------------
Hope this helps,
Regards,
Cerebrus.
Yes i allready have this (Private mySaveButtonText As String = cSaveText)
but this does not help.
If propertyvalue is not specified from property window, value is still
nothing.
Meelis
"Cerebrus" <zor...@sify.com> wrote in message
news:1142846357.4...@t31g2000cwb.googlegroups.com...
Regards,
Cerebrus.
You should set the initial values in the constructor of your class.
The DefaultValue attribute is used by Visual Studio in the properties window: When you right click the property you will see a Reset item in the menu. It will reset the value to the one assigned in the DefaultValue attribute.
Regards.
"Meelis Lilbok" <meelis...@deltmar.ee> escribió en el mensaje news:e9v0Ud$SGHA...@TK2MSFTNGP09.phx.gbl...
But what when i want to change property in design mode and when no value is
entered for property
then defualtvalue is omitted automatically?
Regards;
Meelis
"José Manuel Agüero" <chema012 en hotmail.com> wrote in message
news:u$vKiVBTG...@TK2MSFTNGP11.phx.gbl...
Regards.
"Meelis Lilbok" <meelis...@deltmar.ee> escribió en el mensaje news:e$PQycBTG...@tk2msftngp13.phx.gbl...