Functions should always return a value. Unlike the C# compiler, the Visual Basic compiler does not enforce this rule, and allows you to omit the return value. This is generally bad programming practice, and can indicate logic problems in your application.
The following examples show potential issues that may be indicated by a function without a return value:
1. The code should return a value, but the return statement is omitted due to a coding or logic error:
Function AddCustomer (Name As String) As Integer
' This code should return the customer number of the customer added.
Dim NewKey As Integer
NewKey = AddToTable (Name)
End Function