Welcome to MSDN Blogs Sign in | Join | Help

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: , ,
Published Tuesday, March 04, 2008 7:05 PM by Chris Boyd

Comments

Friday, March 07, 2008 3:05 AM by Paul Conroy

# re: Canceling the Before Save Event

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

Friday, March 07, 2008 3:07 AM by Paul Conroy

# re: Canceling the Before Save Event

Hi Chris

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

Thanks

Paul

Anonymous comments are disabled
 
Page view tracker