Problem with VB.net

Topics: Developer Forum
Aug 22, 2008 at 5:04 PM
Edited Aug 22, 2008 at 5:09 PM
I Raf, i use your collection with my entity written in vb.net. But the raf collection don't track the status item correctly.
I have translate the [field: NonSerialized]  in vb.net :

 

Protected Sub OnDataChanged(ByVal PropertyName As String)
If PropertyChangedHandlers IsNot Nothing Then
    RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(PropertyName))
End If
End Sub 
<NonSerialized()> _ 
Public PropertyChangedHandlers As Generic.List(Of PropertyChangedEventHandler)
Public Custom Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
    AddHandler(ByVal value As PropertyChangedEventHandler)
    
If PropertyChangedHandlers Is Nothing Then
        
PropertyChangedHandlers = New Generic.List(Of PropertyChangedEventHandler)()
    PropertyChangedHandlers.Add(value)
    End If
    End AddHandler 
   RemoveHandler(ByVal value As PropertyChangedEventHandler)
        PropertyChangedHandlers.Remove(value)
    End RemoveHandler 
    RaiseEvent(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
        For Each Element As PropertyChangedEventHandler In PropertyChangedHandlers
    Element.Invoke(sender, e)
    Next 
End RaiseEvent 
End Event

When get HasChanges don't return the correct value (true in this case). I have look when i modify a row _PropertyChanged is always null

 Private 

 

void OnPropertyChanged(object sender, PropertyChangedEventArgs e) 
 {
if(_PropertyChanged != null
{
if(_Status == ObjectStatusType.Normal) 
_Status =
ObjectStatusType.Modified; 
_PropertyChanged(
this, e); 
}
}

 

 

 

 


What is the problem ?? My translation in vb.net ??
Thanks Stefano
Aug 23, 2008 at 11:38 AM
Sorry, but the problem is not VB.net. If i don't use Add for adding item, for eg. when deserialize a collection, the status tracking don't work fine.
If i add the item work fine for the parent and child collection.
Thanks

Stefano