Export (0) Print
Expand All

Procedure Declaration for Visual Basic 6.0 Users

Visual Basic 2008 introduces several changes related to the declaration of procedures.

Visual Basic 6.0

In Visual Basic 6.0, you can declare a procedure parameter as Optional without specifying a default value. If an optional parameter is of the Variant type, the procedure code can use the IsMissing function to determine whether the calling code passed an argument to that parameter.

Visual Basic 2008

In Visual Basic 2008, every optional parameter must declare a default value, which is passed to the procedure if the calling program does not supply that argument. The IsMissing function is not needed to detect a missing argument, and it is not supported. The following example shows an optional argument declaration:

Sub Calculate(Optional ByVal Switch As Boolean = False)


Visual Basic 6.0

In Visual Basic 6.0, you can declare a procedure with the Static modifier. This causes every local variable within the procedure to be static and to retain its value between calls.

Visual Basic 2008

In Visual Basic 2008, the Static keyword is not supported in a Function or Sub statement. You must individually declare each local variable you want to be Static.

Community Additions

ADD
Show:
© 2014 Microsoft