Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleUse optional parameters with default values
Keywordsoptional, optional parameters, default
CategoriesTips and Tricks, Software Engineering
 
You cannot use IsMissing with this technique to see which arguments are missing. If you just want to use default values, however, this is easier and gives you stricter type checking than in available with Variants.

Use the Optional keyword before the parameter declaration and provide a default value after it. Optional parameters must come at the end of the parameter list. That means if one parameter is optional, all following parameters must also be optional.

 
Private Sub Draw(Optional X As Single = 720, Optional Y As _
    Single = 2880)
    Cls
    Circle (X, Y), 700
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated