Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

line labels and goto from VB

Status
Not open for further replies.

mike777

Programmer
Jun 3, 2000
387
US
I am accustomed, in VB, to using line labels. I might say:
sub mike()
dim x as integer
myLineLabel:
x=x+1
msgbox("this is a test")
if x<5 then
goto myLineLabel
end if
end sub

(That's not really the context in which I would use line labels, just the first quick and easy example that came to mine.)
The question is, is there an equivalent in Fox Pro. I haven't been able to find anything on this in the Help Files.
Thank you for whatever assistance you can provide.
-Mike
 
There is not a goto statement in Foxpro.

Try reorganizing your code to goto to the code lines you
want using structured programming statements.
(i.e. Do case...End case, Do while...Enddo, For...next, etc.)


Darrell 'We all must do the hard bits so when we get bit we know where to bite' :)
 
Hi,

In Visual FoxPro progarm flow is basically from top to bottom. Rather than using a goto command, Visual FoxPro uses calls to procedures and functions which can be passed paramenter. The flow of execution in the procedure or function is also from top to bottom. Once the procedure or functions finishes executing, control is returned to the line right after the line that called the procedure/function. example

***************************************
*Remember - Main Program *
***************************************

a = 2
b = 3
c = 0

do calculate_it with a, b
wait window &quot;The value c equals &quot;+str(c,5,0)
return

********************************************
*Remember Procedure calculate_it *
********************************************
Procedure calculate_it
parameter the_a, the_b
c = (The_a * the_b)
return c


The above would produce a window that displayed

the value of c is 6

LelandJ Leland F. Jackson, CPA
Software - Master (TM)
Nothing Runs Like the Fox
 
Hi Mike..

To provide the equivalent of
dim x as integer
myLineLabel:
x=x+1
msgbox(&quot;this is a test&quot;)
if x<5 then
goto myLineLabel
end if
end sub

in VFP..


x=0
DO WHILE x < 5 && myLineLabel:
x=x+1
ans = msgbox(&quot;Want to Continue&quot;,20,&quot;This is a test&quot;)
IF ans = 7
EXIT
ENDIF
ENDDO

The same can be done using FOR .. ENDFOR loop or in some other way as well :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top