Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Remoteapplication.vb is calling
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 14-Feb-13 4:46am
vidkaat528
Edited 14-Feb-13 5:06am
v4
Comments
Mike Meinz at 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 at 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 at 14-Feb-13 10:54am
   
That declares an empty variable of Type BLL.Applications. It does not instantiate (create) it. See Solution2.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
v2

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

  Print Answers RSS
0 Gihan Liyanage 332
1 Sergey Alexandrovich Kryukov 330
2 ClimerChinna 222
3 vikinghunter 168
4 OriginalGriff 166
0 Sergey Alexandrovich Kryukov 8,363
1 OriginalGriff 7,112
2 CPallini 2,598
3 Richard MacCutchan 2,025
4 Abhinav S 1,788


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100