Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Procedures
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01003677
Message ID:
01003693
Views:
18
Neil, basicaly Procedures doesn't returns values, functions does. But the functions returns ONLY one value at the time. For what you describe you must declare these variables as public before you call this procedure or declare as publi in it to have access to them in whole your application. You can create a function with a parameter that shows to it what you want to return. But as I described in a previous threat it is much easier to return an object that holds all variable you want so you don't need to declare these variables as PUBLIC. i,e
1. Declare variable as public BEFORE you call a procedure
** In main.prg
PUBLIC cArtikey, cSupplier, cNewsupplier

DO BaseArti

*** In your form Init Event
thisform.Text1.Value = m.cArtikey
...
2. Define variables as public IN Procedure body (there is no much difference between this and first method)
DO BaseArti
PROCEDURE basearti()
 PUBLIC cArtikey, cSupplier, cNewsupplier
 STORE "F*0001" TO cArtikey
 STORE "ZOOM" TO cSupplier
 STORE "YES" TO cNewsupplier
ENDPROC


*** In your form Init Event
thisform.Text1.Value = m.cArtikey
...
3. Pass a parameter to show what you want to return
*** In your form Init Event
thisform.Text1.Value = BaseArti(1)
thisform.Text2.Value = BaseArti(2)
...

FUNCTION basearti(what_to_return)
 DO CASE
    CASE what_to_return == 1
         RETURN "F*0001"
    CASE what_to_return == 2
         RETURN  "ZOOM"
    CASE what_to_return == 3
         RETURN "YES"
 ENDCASE
 RETURN ""
ENDPROC
4. Return an object that holds all you need
*** In your form Init Event
LOCAL oEmpty
oEmpty = BaseArti()

thisform.Text1.Value = oEmpty.cArtikey
thisform.Text2.Value = oEmpty.cSupplier
thisform.Text3.Value = oEmpty.cNewsupplier
...

FUNCTION basearti()
   LOCAL oTmp AS EMPTY
   oTmp = CREATEOBJECT("EMPTY")
   ADDPROPERTY(oTmp, "cArtikey","F*0001")
   ADDPROPERTY(oTmp, "cSupplier","ZOOM")
   ADDPROPERTY(oTmp, "cNewsupplier","YES")
 RETURN oTmp
ENDPROC
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform