Hi All,
I am creating a component library and I have a function that contains
optional parameters. Here's the skeleton code for the function:
Public Function SearchBook(ByVal page as String, Optional ByVal keyword
As String = Nothing, Optional ByVal categoryID As String = Nothing) As Book
' implementation code omitted
End Function
My gripe is with the optional parameters. Specifically, this function
can be used three ways:
1. use take the page and keyword params (omitting the catagoryID param)
2. use the page and categoryID params (omitting the keyword param)
3. use all three params.
Are there any penalties for ignoring only one of the optional
parameters? Must they both be used (because I don't feel like writing
overloaded functions)if one of them is used? Is the order in which
they're placed an issue?
Thanks,
Roshawn