>Hi all,
>
>I have a form that can call benchmark method inside and works well.
>
>
>
>if glModifyBenchmark then
> LcBenchAccountToRerun = alltrim(ThisForm.textbox8.value)
>
> thisform.benchmark(LcBenchAccountToRerun)
>
>else
> DO rerun
>endif
>
>***benchmark method :: inside the form
>
>PARAMETERS lcAcctRerun
>LOCAL lcOldCentury, lcOldSetDate,lcUser
>*LcTest = LcBenchAccountToRerun
>*LcTest2 = glModifyBenchmark
>
>WAIT WINDOW NOWAIT 'Extracting Benchmark...'+lcAcctRerun
>
>SET ASSERTS ON
>ASSERT .f.
>
>WAIT WINDOW 'The user is :'+gcUser TIMEOUT .5
>
>WAIT clear
>
>
>
>second way : I try but not sure how to pass parameters
>
>how to pass the paramaters by calling benchmark program individually ?
>
>
>if glModifyBenchmark then
> LcBenchAccountToRerun = alltrim(ThisForm.textbox8.value)
>
> do benchmark with ??????
>else
> DO rerun
>endif
>
>
>PROCEDURE benchmark
>
>PARAMETERS lcAcctRerun
>
>LOCAL lcOldCentury, lcOldSetDate
>LcTest = LcBenchAccountToRerun
>LcTest2 = glModifyBenchmark
>
>? lcAcctRerun
>
>SET ASSERTS ON
>ASSERT .f.
>
>? lcAcctRerun
>
>WAIT WINDOW NOWAIT 'Extracting Benchmark...'
>
>
>
>The reason to do this because benchmark.prg will be used or called from
>many forms.
>
>Please assist to correct my codes.
>TIA
Paul,
Benchmark.prg exists:
do benchmark with m.LcBenchAccountToRerun
*or
Benchmark(m.LcBenchAccountToRerun)
Benchmark is a procedure in a prg say myProcs.prg:
set procedure to myProcs.prg additive
do benchmark with m.LcBenchAccountToRerun
*or
Benchmark(m.LcBenchAccountToRerun)
are simple and most used ways. There are slight differences:
do benchmark with m.LcBenchAccountToRerun
By default m.LcBenchAccountToRerun is passed by reference and not suitable if a return value is needed.
Benchmark(m.LcBenchAccountToRerun)
By default m.LcBenchAccountToRerun is passed by value (similar but not exactly calling form method)
Actually even this would do:
do benchmark
* or
Benchmark()
because with the way you create the m.LcBenchAccountToRerun variable (by default private if no scope is defined like local or public,private) any prg/procedure called can see m.LcBenchAccountToRerun variable (in scope - with a form method it's not).
OK in plain English it's getting confusing:) Here is how I would do:
Benchmark(ThisForm.textbox8.value)
PS: I assume gcUser means public character variable. Please keep away from public variables.
Cetin