Canceling the Before Save Event

Canceling the Before Save Event

  • Comments 2

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: , ,
Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post
  • 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

  • Hi Chris

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

    Thanks

    Paul

Page 1 of 1 (2 items)