The following code gives a "Object reference not set to an instance of an object. Module:SalesOrder_Created"
Could you help please?
Thanks !
- Code: Select all
Public Class FormPlugin
Inherits System.MarshalByRefObject
Implements JiwaApplication.IJiwaFormPlugin
Private salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm
Public Overrides Function InitializeLifetimeService() As Object
' returning null here will prevent the lease manager
' from deleting the Object.
Return Nothing
End Function
Public Sub SetupBeforeHandlers(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.SetupBeforeHandlers
End Sub
Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.SalesOrderEntryForm)
AddHandler salesOrderForm.SalesOrder.Created, AddressOf SalesOrder_Created
End Sub
Public Sub SalesOrder_Created(sender As Object, e As System.EventArgs, ByVal NewSalesOrderType As JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes, ByRef SourceQuoteObject As JiwaSales.SalesQuote.SalesQuote)
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
If salesOrder.CreditNote Then
msgbox ("Cr Note")
salesOrderForm.BackColor= System.Drawing.Color.Red
Else
msgbox ("NOT Cr Note")
End If
End Sub
'
End Class