StrataFrame Forum

Refreshing screen to reflect BO changes.

http://forum.strataframe.net/Topic9489.aspx

By rmoore - 6/12/2007

I have 2 maintenance forms (FormA and FormB), bound to different BO's. For the sake of simplicity, these exist as a 1-1 relationship. FormB can be opened from FormA as a modal dialog as long as the relationship exists. Both these BO's have an ApprovedByID which gets set when the user clicks an approve button that is on each of the forms. I have a custom field property in each of these BO's that resolves the ID  and places the name of the person that approved the form and gets displayed on the form as well. What I want to happen is that if FormB is opened on top of FormA and the user clicks the approve button on FormB, have their name persist back to FormA.

Here's what I use to set the ApprovedByID from within a separate BO.

Public Sub SetApprovedByID(ByVal empID As Int32)

' Mark this problem review approved

Me.ApprovedByEmployeeID = empID

' Check to see if a credit memo is linked to this problem review, if so mark it approved

Using loBO As New CreditMemosBO()

loBO.FillByProblemReviewID(CType(Me.ProblemReviewID, Int32))

If loBO.Count > 0 Then

loBO.ApprovedByEmployeeID = empID

loBO.Save()

End If

End Using

 

The data is being persisted back to the database, but is not reflecting the change on the FormA after FormB is closed. Any help would be appreciated.

Thanks

By StrataFrame Team - 6/12/2007

After you change the data that makes the custom field property's value change, you need to raise some sort of Changed event so that the bindings know to refresh the data.  Basically, create an event called PropertyNameChanged where "PropertyName" is the name of your custom property.  You'll need to create it as an event handler like this:

Public Event PropertyNameChanged As EventHandler

And raise the event at the bottom of the SetApprovedByID.  That will tell FormA to refresh the controls bound to your custom property.