DOCUMENT:Q163229 02-APR-1997 [vbwin] TITLE :HOWTO: Use Optional Arguments in Intrinsic Data Types PRODUCT :Microsoft Visual Basic for Windows PROD/VER:5.0 OPER/SYS:WINDOWS KEYWORDS:kbusage vb5all vb5howto VBKBInfo_VBKBVB kbhowto ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0 --------------------------------------------------------------------- SUMMARY ======= One of the new features of Microsoft Visual Basic 5.0 is the ability to define Optional arguments for data types other than Variant. These optional arguments are used in procedures. MORE INFORMATION ================ Microsoft Visual Basic allows optional arguments for the following data types: Data type --------- Currency Double Integer Long Single String Object The following conditions and notes should be considered: 1. The Optional argument must be capable of being assigned a default value. When a procedure that has Optional arguments is called, Microsoft Visual Basic 5.0 assigns all arguments that were not included with a default value. Thus, an Optional array is not possible. 2. Optional arguments of user-defined data types are not supported. Microsoft Visual Basic 5.0 only supports Optional arguments of intrinsic data types. 3. Optional arguments that are of intrinsic data types always return False when used with the IsMissing function. This occurs because the IsMissing function is explicitly designed for un-initialized Variant data types. Because an intrinsic Optional argument always gets its default value if not passed to the procedure, it is never missing. 4. Applications written with earlier versions of Visual Basic for Applications will ignore the Optional modifier, and thus require the argument(s). A good example of this is Microsoft Access for Windows 95. REFERENCES ========== Microsoft Visual Basic Online Help Additional query words: simple data types nonvariant ====================================================================== Keywords : kbusage vb5all vb5howto VBKBInfo_VBKBVB kbhowto Version : 5.0 Platform : WINDOWS Issue type : kbhowto ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1997.