Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my FormActionHandler code:

VB
Public Shared Function DeleteVendor(ByVal oldVendor As Vendor, ByVal newVendor As Vendor) As Boolean
        Dim aServiceFactory As PayableAppServiceFactory = PayableAppServiceFactory.GetInstance()
        Dim aVendorService As VendorService = aServiceFactory.GetServiceInstance(PayableAppServiceFactory.SERVICE_NAME.Vendor)
        Return aVendorService.DeleteVendor(oldVendor, newVendor)
    End Function


Now, here is the code I'm generating an error which is pointing to the Form ActionHandler:

VB
Private Sub btnDeleteVendor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteVendor.Click
        Dim message As String
        message = "Confirm deletion vendor " & txtVendorID.Text & " : " & NameTextBox.Text & "?"
        If MessageBox.Show(message, "DELETE VENDOR", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
            Try
                If Not FormActionHandler.DeleteVendor(vendor) Then
'---------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    MessageBox.Show("Vendor could not be deleted. Another user has updated or deleted that vendor.", _
                    "Database Error")
                    Me.GetVendor(vendor.VendorID)
                Else
                    MessageBox.Show("Vendor has been Deleted")
                    VendorBindingSource.Clear()
                End If
            Catch ex As Exception
                MessageBox.Show(ex.Message, ex.GetType.ToString)
            End Try
        End If
    End Sub
End Class


The line I've bolded marked with '-----^^^ is the line that's giving me an error. Could someone help me with this?^

Thank you!
Posted
Updated 6-Dec-10 0:36am
v2
Comments
Manfred Rudolf Bihy 6-Dec-10 6:37am    
Changed marker of error line. <b> tag doesn't seem to work inside pre tags. (Probably by design :) )

1 solution

How many parameters (input variables) use your function?
Public Shared Function DeleteVendor(ByVal oldVendor As Vendor, ByVal newVendor As Vendor) As Boolean
and code inside DeleteVendor() function:
Return aVendorService.DeleteVendor(oldVendor, newVendor)


Now, how many parameters you use here:
If Not FormActionHandler.DeleteVendor(vendor) Then?

You should pass 2 parameters if your function has no default values.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 6-Dec-10 15:49pm    
Good call! Why didn't I catch that. Probably because of my attention defic... Oh loook shiny! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900