Function '<procedurename>' doesn't return a value on all code paths
A Function procedure has at least one possible path through its code that does not return a value.
You can return a value from a Function procedure in any of the following ways:
Include the value in a Return Statement (Visual Basic).
Assign the value to the Function procedure name and then perform an Exit Function statement.
Assign the value to the Function procedure name and then perform the End Function statement.
If control passes to Exit Function or End Function and you have not assigned any value to the procedure name, the procedure returns the default value of the return data type. For more information, see "Behavior" in Function Statement (Visual Basic).
By default, this message is a warning. For more information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.
Error ID: BC42105
To correct this error
Check your control flow logic and make sure you assign a value before every statement that causes a return.
It is easier to guarantee that every return from the procedure returns a value if you always use the Return statement. If you do this, the last statement before End Function should be a Return statement.