Wednesday, March 27, 2013

Property Does not initialise even though we assign value to it in VB.net

I have came around a strange situation in vb.net when i was assigning value to property it was not at all taking the value.When i debug it ,i was getting Nothing.Actually when i was creating property i got the intellisense.This intellisense created structure of the property.
Now the problem comes when we use this property for setting value.The structure we got for property was
        
Public Property runs As String
          Get

          End Get
          Set(value As String)

          End Set
        End Property
Now when we assign value to the property it will not even go to the property in debug mode.After investigating i found that there is a small change that we have to make while using intellisence.In Set we have to give ByVal the all wioll be fine. So the structure of property should be like Public Property runs As String Get End Get Set(ByVal value As String) End Set End Property

No comments :

Post a Comment