IsSavable on BLB root

IsSavable on BLB root

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


bgilbert posted on Thursday, September 27, 2007

I've implemented an IsSavable in a BLB-derived root class. It looks something like this:

 Public Function IsSavable() As Boolean
        If Me.DeletedList.Count > 0 Then
            Return True
        End If
        For Each item As myChildClass In Me
            If Not item.IsSavable Then
                Return False
            End If
        Next
        Return True
    End Function


I call this from the bindingsource's CurrentItemChanged event to set the Save button's enabled. The problem is that, at the point in the process when the CurrentItemChanged event is raised, RemoveItem hasn't yet been called and so the DeletedList is empty.

Am I approaching this the right way? If so, is there a different event I should trap to evaluate IsSavable?

bgilbert replied on Friday, September 28, 2007

Ok. I see that the timing of the raising of ListChanged events has changed in 3.0. This will fix this issue for me.

Copyright (c) Marimer LLC