VB 2005 supports both functions and subroutines. Basically, support for functions and subroutines is the same in VB 2005 as it is in VB 6. However, VB 2005 provides you with an additional way to return values in a function by means of the new
Return statement. VB 2005 programmers have three choices: they can write their own functions, continue using most of the VB 6 functions they have come to know and love, or tap into the rich functionality of the .NET Framework Class Library through the new
My namespace (see "My Namespace," later in this chapter).
A function is a block of code that performs some operations and then returns a value. For example, the following function
Area takes in two input parameters, computes the area, and then returns the result:
FunctionArea(ByVal length As Single, _ ByVal breadth As Single) As Single Dim result As Single result = length * breadth
To invoke a ...