ListChanged in Remoting

ListChanged in Remoting

Old forum URL: forums.lhotka.net/forums/t/3004.aspx


Skeeboe posted on Thursday, June 07, 2007

In 2.1.1.0 and 2.1.1.4 the ListChanged event does NOT get called in remoting mode. Even as a test, I've created a small root>collection>child object and pop a msgbox when the listchanged event is called. It works great until you try to do it with remoting. Once in remoting mode, I can get the collection to fill but if I make a change the msgbox never pops. I know its not popping on the server since the program responds as expected and isn't hung waiting on a msgbox to close on the server.

I posted about this back in 1.53 for .net 2.0 days but I'm all 2.1+ now and I still can't get it to work.

I need that event to fire so I know when to calculate new payment value based on the something in the children changing.

Thanks.

Brian Criswell replied on Friday, June 08, 2007

Would it be possible for you to post some code showing where and how you hook up the event handler and what code you expect would trigger the ListChanged event?  Writing to a log file may also be a bit better than trying to show a message box.

McManus replied on Friday, June 08, 2007

Hi Skeeboe,

Did you override OnDeserialized in the root object?

You should call collection.ListChanged += new ListChangedEventHandler(<handler>) in OnDeserialized.

Cheers,

Herman

Skeeboe replied on Wednesday, June 13, 2007

K, that worked. Finally, I've been asking that for about two years in 1.53 and didn't know I had to rehook those on a deserialized event call. Someone elaborated on that before but not as specific.

So in 2.1.1.x I do this:

Protected Overloads Overrides Sub OnDeserialized(ByVal context As System.Runtime.Serialization.StreamingContext)

    AddHandler Me.ListChanged, AddressOf Children_ListChanged

End Sub

in 1.53 I do this:

Protected Overrides Sub Deserialized()
        MyBase.Deserialized()
        AddHandler MyChild.ListChanged, AddressOf Children_ListChanged
End Sub

Thanks!

Copyright (c) Marimer LLC