Apparently, i missunderstanding what i read before. componenmodel.defaultvalue is used for other purpose (designer). thanks
andiyuniar
Posts
-
Which is the best way to set default value for properties -
Which is the best way to set default value for propertiesI used the second code, but i didn't realize until your reply. Yes, the 2nd code doesnt work if we change the value to 'true' I googling to msdn and find this statement: "A DefaultValueAttribute will not cause a member to be automatically initialized with the attribute's value. You must set the initial value in your code."
Private MyVar as Boolean = False
<DefaultValue(False)> _
Public Property MyProperty() As Boolean
Get
Return MyVar
End Get
Set
MyVar = Value
End Set
End Propertyand it make me more confuse,what is the function of this <DefaultValue(False)>
-
Which is the best way to set default value for propertiesHi there, I'm newbie here, I want to know, to set default value for property, which is the best way? 1.
Private _AddFoto As Boolean = False
Public Property AddFoto() As Boolean
Get
Return _AddFoto
End Get
Set(ByVal value As Boolean)
_AddFoto = value
End Set
End PropertyOr 2.
Private _AddFoto As Boolean
<ComponentModel.DefaultValue(False)> _
Public Property AddFoto() As Boolean
Get
Return _AddFoto
End Get
Set(ByVal value As Boolean)
_AddFoto = value
End Set
End PropertyThanks
-
set binary image in Image web control.Thanks. it help me.
-
set binary image in Image web control.In my web application, I need to display binary image from database in image web control. I can convert binary data to image, but how to bind it to Image web control? Please help me.