Passing null or Optional values to functions in VB6
Posted on 2005-03-28
I have written a DLL function that takes 11 parameters, However all eleven parameters may not allways be needed.
How can I call my function in a way that I dont have to specify emtpy strings. ie like this:
X = myFunction(Val1, Val2, Val3, , , , , , , Val10, Val11)
Currently I have to do this :
X = myFunction(Val1, Val2, Val3, "", "", 0, 0, "", 0, Val10, Val11)
An argument can only be omitted from a call to a user-defined procedure if it was declared Optional in the procedure declaration. Either supply the argument in the call or declare the parameter Optional in the definition.
I have tried:
Optional Val1 As String
Val1 As Optional String
Val1 As String Optional, etc