Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling Procedure in a Program (.PRG)
Message
De
23/10/2018 14:00:13
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Calling Procedure in a Program (.PRG)
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01662746
Message ID:
01662746
Vues:
73
Respected all,

I have a .prg File , in which I have sequence of procedures I have to carry on one by one to get my desired results. Till Now I have kept all procedures in sequence of one another, but since there are many such procedure (Steps) involved and my .prg has become big and less understandable easily.

I am thinking to put procedures at the end of .prg and Call that procedure step by step so that it may be easily comprehended.

For this I have kept one of such Procedure under PROCEDURE LEFTBOX at the end of my .prg file and calling that procedure using DO Leftbox.

The procedure is generating value for it but when it comes back to the main routine it gives error as variable Boxstartrow not found.

If I declare Boxstartrow as PUBLIC, it works fine.

Will I have to declare all such variables as Public, which I am intending to use in procedure or there is some other way also ?

Here is my Code
Do Leftbox

Do abc

Do xyz

*Some Other Code

PROCEDURE Leftbox
Locate For Left(Alltrim(PS),4)='1 w1' AND Right(Alltrim(PS),1)='k'
Replace PS With ;
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1))-15))) ;
PS With ;
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-4))-4)))	;
PS With ;		
STRTRAN(PS,Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2), Alltrim(Str(Val(Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-2))+4)))
cNEWBOTTOMLINE=Getwordnum(Alltrim(PS), Getwordcount(Alltrim(PS))-1)
BOXSTARTCOLUMN=Val(Getwordnum(PS, Getwordcount(PS)-4))
BOXENDCOLUMN=385
BOXSTARTROW=Val(Getwordnum(PS, Getwordcount(PS)-3))
BOXENDROW=BOXSTARTROW+Val(Getwordnum(PS, Getwordcount(PS)-1))
BOXCOLUMNRANGE=385-m.BOXSTARTCOLUMN					
RETURN
Thanks as Always.
Harsh
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform