Hi,
Can anyone tell me how to setup optional parameters in a method?

Re: Optional Parameter by Rush

Rush
Tue Dec 30 14:41:33 CST 2003

in FoxPro, all parameters are optional - for example, MyForm.DoStuff(a, b, ,
d) would execute DoStuff with only the first, second, and fourth parameter
supplied.

Of course, you'll have to resolve the parameters within your method - any
missing parameters will be initialized as a logical .F., regardless of
'expected' data type.

- Rush

"Roger Cantillo" <rogerc@axiomsw.com> wrote in message
news:OPPM5OxzDHA.1576@TK2MSFTNGP11.phx.gbl...
> Hi,
> Can anyone tell me how to setup optional parameters in a method?
>
>
>
>



Re: Optional Parameter by Trey

Trey
Tue Dec 30 14:52:56 CST 2003

Inside VFP, all parameters are optional.

If you are using a VFP7+ COM dll, you can specify optional parameters with
_COMATTRIB - 5th element
e.g.

Define Class myTestClass As custom OLEPublic

Dimension myMethod_COMATTRIB(5)
myMethod_COMMATTRIB[5]=2 && makes only the first 2 params required

Procedure myMethod (param1 as integer, param2 as string, param3 as
string)
** proc code
EndProc

EndDefine

"Roger Cantillo" <rogerc@axiomsw.com> wrote in message
news:OPPM5OxzDHA.1576@TK2MSFTNGP11.phx.gbl...
> Hi,
> Can anyone tell me how to setup optional parameters in a method?
>
>
>
>



Re: Optional Parameter by David

David
Mon Jan 05 18:28:35 CST 2004

Roger,

To add to the other replies, You can use the pcount() function inside the
method to determine how many parameters were passed.

df

"Roger Cantillo" <rogerc@axiomsw.com> wrote in message
news:OPPM5OxzDHA.1576@TK2MSFTNGP11.phx.gbl...

> Can anyone tell me how to setup optional parameters in a method?