BeforeDelete Event Issue


Author
Message
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
No sweat! Glad you got it working BigGrin
Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
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

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Judging by your code sample you aren't Smile. 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


Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
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. Wink

Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
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

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.
Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
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.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Jeff.

Have a look at the posts starting from here:

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

Hope it helps.

Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
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.BeforeDelete

If CType(Me.CreditMemosBO1.ApprovedByEmployeeID, Int32) > 0 Then

MessageBox.Show("Unable to delete." & vbCrLf & vbCrLf & "The credit memo has been approved.", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information)

e.Cancel = True

ElseIf CType(Me.CreditMemosBO1.GLExportByUserID, Int32) > 0 Then

MessageBox.Show("Unable to delete." & vbCrLf & vbCrLf & "The credit memo has been exported to the accounting system.", "System Notification", MessageBoxButtons.OK, MessageBoxIcon.Information)

e.Cancel = True

End If

End Sub


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search