By Jeff Pagley - 10/6/2008
Hi SF Team,When I set the e.cancel = True in the BeforeDelete event, it is NOT stopping the Deletion Comfirmation Dialog from showing to the end user. Although, when the user does click OK, it does NOT delete the record. Thanks, Jeff Below is the code: Private Sub CreditMemosBO1_BeforeDelete(ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs) Handles CreditMemosBO1.BeforeDeleteIf CType(Me.CreditMemosBO1.ApprovedByEmployeeID, Int32) > 0 ThenMessageBox.Show( "Unable to delete." & vbCrLf & vbCrLf & "The credit memo has been approved.", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information)e.Cancel = TrueElseIf CType(Me.CreditMemosBO1.GLExportByUserID, Int32) > 0 ThenMessageBox.Show( "Unable to delete." & vbCrLf & vbCrLf & "The credit memo has been exported to the accounting system.", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information)e.Cancel = TrueEnd IfEnd Sub
|
By Ivan George Borges - 10/6/2008
Hi Jeff.Have a look at the posts starting from here: http://forum.strataframe.net/FindPost7946.aspx Hope it helps.
|
By Jeff Pagley - 10/6/2008
Hi Ivan,To be honest, I already saw that post and I'm not sure how it applies to the problem I have. I just want the business object to work as design. In other words, when I set the e.cancel to true in the BeforeDelete event, I want to stop the deletion process as it says it should. My problem is the Deletion Confirmation dialog is still appearing to the end user which it should not if I understand correctly on how it works.
|
By Trent L. Taylor - 10/6/2008
If you are handling this on the BO then that could be true. But if you handle this on the form, then it should not show the auto-deletion confirmation. Remember the form level events that exist on the form that mirror the BOs, you might try and place your logic there in this case to see if it resolves your problem.
|
By Jeff Pagley - 10/7/2008
Hi Trent,Unfortunately, it is on the form where I am handling the BeforeDelete event. By the way, I tried it on two different forms and the same thing is happenning. FYI, I am using the MaintenanceFormToolStrip. Thanks, Jeff
|
By Ivan George Borges - 10/7/2008
Hey Jeff.I might have misunderstood what you meant, by that link showed you that the confirmation message will show up anyway if set to do it. So, you might want to turn the "AutoShowDeleteConfirmation" property in the form to False and then provide your own confirmation message in the BeforeDelete, according to your conditions. Sorry if I still didn't get it.
|
By Dustin Taylor - 10/7/2008
Judging by your code sample you aren't . Trent wasn't referring to handling the instance of the BO on the form rather than the base BO itself, he was referring to handling the form object's BeforeDelete event.This is the first line of your code sample: Private Sub CreditMemosBO1_BeforeDelete(ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs) Handles CreditMemosBO1.BeforeDelete It should read as such, where "MyForm" is the name of your form: Private Sub CreditMemosBO1_BeforeDelete(ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs) Handles MyForm.BeforeDelete
|
By Jeff Pagley - 10/8/2008
Hi Dustin/Trent,You are right. Sorry about the confusion!')" href="http://forum.strataframe.net/Skins/Classic/Dialogs/InsertEmotIcon.aspx?ControlID=txtPost#"> It is working properly now. As always, thank you for the great support and patience. Jeff
|
By Dustin Taylor - 10/8/2008
No sweat! Glad you got it working
|
|