Canceling the Before Save Event


Hello,

A good question came in yesterday; how to cancel the Project Before Save event in Project client:


Public Sub GlobalApplication_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi As Boolean, Cancel As Boolean)
 
         Cancel = True
      
End Sub


(For demonstration and simplicity, this event handler just cancels all saves. You would most likely want to add validation and if it fails, cancel the save)


Unfortunately the above code will not work. Instead, you will want to use ProjectBeforeSave2:



Public Sub GlobalApplication_ProjectBeforeSave2(ByVal pj As Project, ByVal SaveAsUi As Boolean, Info As EventInfo)

         Info .Cancel = True

End Sub


Hope this helps,


Chris Boyd


 


Technorati tags: , ,

Comments (2)

  1. Paul Conroy says:

    Hi Chris

    Where do I need to place this code in order for it to work.  Is there any other code I need to enter to support it?

    Thanks

    Paul

  2. Paul Conroy says:

    Hi Chris

    Where do I need to place this code.  Is there any other supporting code I need to enter?

    Thanks

    Paul

Skip to main content