Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Remoteapplication.vb is calling
VB
Public Function GetDeliveryDelayDays() As DataTable

          Dim bll As BLL.Applications
          Dim Retval As DataTable = Nothing
          Dim ds As DataSet = Nothing
          bll = New BLL.Applications
          Try

              ds = bll.GetDeliveryDelayDays()
              If Not (ds Is Nothing) Then Retval = ds.Tables(0)

          Catch ex As Exception

              Throw ex

          Finally

              bll = Nothing

          End Try

          Return Retval

      End Function
 Application.vv(Business logic Layer) calls DAL
Public Function GetDeliveryDelayDays() As DataSet

            Dim ds As DataSet = Nothing
            Dim Applications As New DAL.Applications

            Try

                ds = Applications.GetDeliveryDelayDays()


            Catch ex As Exception

                HandleException(ex)

            Finally

                Applications = Nothing

            End Try

            Return ds

        End Function

But i get an error that "Method not found: 'System.Data.DataSet PowerPay.DAL.Applications.GetDeliveryDelayDays()'."Please help.
Posted
Updated 14-Feb-13 5:06am
v4
Comments
Mike Meinz 14-Feb-13 10:49am    
Have you stepped through the code with the Visual Studio debugger to identify which line throws the exception?

My guess is that it is the line ds = bll.GetDeliveryDelayDays(). I think this because that while you declared the variable bll, you did not instantiate it.

See Solution 2.
vidkaat 14-Feb-13 10:53am    
Yes u r right. When you say instantiate bll,i already did that Dim bll As BLL.Applications?

Mike Meinz 14-Feb-13 10:54am    
That declares an empty variable of Type BLL.Applications. It does not instantiate (create) it. See Solution2.

Object reference not set to an instance of an object

This error happens when you try to use a property or call a method of an object that is null. More details: here[^]

A simple use of Visual studio DEBUGGER can tell you the object because of which it is happening. Just look at the stack trace and put a debugger on that line. Check the objects of that line and see if any one is null and you are trying to use that objects property. Handle the same.
 
Share this answer
 
I added a line of code to instantiate bll.

Public Function GetDeliveryDelayDays() As DataTable
            Dim bll As BLL.Applications
            Dim Retval As DataTable = Nothing
            Dim ds As DataSet = Nothing
            bll = New BLL.Applications
            Try
                ds = bll.GetDeliveryDelayDays()
                If Not (ds Is Nothing) Then Retval = ds.Tables(0)
            Catch ex As Exception
                Throw ex
            Finally
 
                bll = Nothing
            End Try
            Return Retval
        End Function
 
Share this answer
 
v2

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