It gives the error during design time ... what I want to happen is to trap the ErrorSaving event in the ASPX codebehind page when it happens so I can rip the message out of the e argument and display it to the user. So, my first question probably should be "Can I trap the ErrorSaving event in the codebehind page of an ASPS form?) And, I'm quite sure the answer to that question is, yes.
The next thing that I tried to do is to add an error handler to the Prefix class like follows:
Public Sub Prefix_ErrorSaving(ByVal e As MicroFour.StrataFrame.Business.ErrorSavingEventArgs)
Me.ESEA = e
End Sub
(Ignore the code inside of that Public Sub ... I was just playing around with a work-around that is not viable.)
Next, I added the following code to the codebhind page
Private Sub ErrorSaving(ByVal e As MicroFour.StrataFrame.Business.ErrorSavingEventArgs) Handles oPrefix.Prefix_ErrorSaving
Dim lcErrorText As String = ""
lcErrorText = Me.GenerateWarningTable(e.ToString)
SetErrorsLabelState("Show", lcErrorText)
End Sub
Now I get the error message that says event Prefix_ErrorSaving cannot be found.
Realize that this is the second iteration of me trying to pull my head out of my arse. The only thing I really need is to learn how to trap the ErrorSaving event in the codebhind page so I can get to the ErrorSavingEventArgs message. Note: Do not assume I know jack shyte about what I am doing in this instance, treat the answer as you would to a suckling babe.
Another way to phrase this (from a superclass code perspective) is
The superclass of the business object tries to raise the ErrorSaving event but the following code
RaiseEvent(ByVal e As ErrorSavingEventArgs)
'-- See if we can directly invoke the event
If Me._Handler_ErrorSaving IsNot Nothing Then
If (Me._SyncObject IsNot Nothing) AndAlso (Me._SyncObject.InvokeRequired) Then
Me._SyncObject.Invoke(Me._Handler_ErrorSaving, New Object() {e})
Else
Me._Handler_ErrorSaving.Invoke(e)
End If
End If
End RaiseEvent
sees that Me._Handler_ErrorSaving was nothing. However, adding the following code to the business object caused this problem to go away ...
Public Sub Prefix_ErrorSaving(ByVal e As MicroFour.StrataFrame.Business.ErrorSavingEventArgs)
Me.ESEA = e
End Sub
But forced me to have to do something stupid like added a custom property to the business object that stores the "e" parameter ... which I access after the save fails ... hoo hisss.
I want the e parameter directly delivered to the code behind page so I can display the error ... but it is soooo dark in here.
I think this just about covers my cranial rectal inversion
Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com