Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Do .... with parameters
Message
From
25/05/2005 17:57:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/05/2005 16:30:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01017644
Message ID:
01017679
Views:
22
>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) && no need to create an unnecessary variable there
PS: I assume gcUser means public character variable. Please keep away from public variables.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform