Well basically I keep a null value returned code and I have the same issue in all 6 of my functions.

Here is the error code - Warning BC42105: Function 'GetTimesheet' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.

   <System.ComponentModel.DataObjectMethodAttribute _
        (System.ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function GetTimesheet() As dsTimesheet.TimesheetDataTable
        Try
            Return Adapter.GetTimesheetData()
        Catch e As Exception
        End Try
    End Function

If your try/catch fails, your function doesn't return anything. Basically it will return Nothing. You can do the same thing with:

<System.ComponentModel.DataObjectMethodAttribute _
    (System.ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function GetTimesheet() As dsTimesheet.TimesheetDataTable
        Try
            Return Adapter.GetTimesheetData()
        Catch e As Exception
            Return Nothing
        End Try
    End Function

It will return exactly the same but you won't get the warning(warnings aren't really errors though). If your bigger issue is with the return value being nothing, the return whatever you want to in the catch section.

If your try/catch fails, your function doesn't return anything. Basically it will return Nothing. You can do the same thing with:

<System.ComponentModel.DataObjectMethodAttribute _
    (System.ComponentModel.DataObjectMethodType.Select, True)> _
    Public Function GetTimesheet() As dsTimesheet.TimesheetDataTable
        Try
            Return Adapter.GetTimesheetData()
        Catch e As Exception
            Return Nothing
        End Try
    End Function

It will return exactly the same but you won't get the warning(warnings aren't really errors though). If your bigger issue is with the return value being nothing, the return whatever you want to in the catch section.

Thank you very much for the help. Everything worked great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.