Link to home
Start Free TrialLog in
Avatar of Kinger247
Kinger247

asked on

Passing multiple parms to proc/func

I’ve forgotten the syntax for sending multiple parameters to a proc/func ?

For example you could call my SaveData proc in any of these ways:

SaveData(Data1, Data2)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc…..)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc….., etc …. etc, …..)


(And I don’t mean passing an array or overloading)

Cant remember the code syntact whan creating the proc/func !!!??!?
Tried googling but its one of them days … :(

Thanks in advance,
K.
Avatar of VipulKadia
VipulKadia
Flag of India image

Hi Kinger247,
when you declare your sub/function, use 'Optional' keywork before parameter.
e.g. Public sub SaveData(Param1 as int, Optional Param2 as int, Optional Param3 as int)
       
Avatar of Kinger247
Kinger247

ASKER

but that means you have to specify all the parameters in your function.
There's a way of doing this withought knowing how many are being passed.
So you could pass 1 paramerter or 1000.
its kind of like specifing an array of parameters ...

ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thats it, thankyou ..
I'm really having one of those dumb days today.