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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling

Status
Not open for further replies.

ellehcsim

Programmer
Dec 9, 2003
16
0
0
PH
hi guys!!

is there such a thing like this in VFP...?

(start of code)
...
...
...
(do something here)
...
...
if (condition)
GOTO LABEL sample_label
else
...
...
...
(do something again)
...
...
endif

...
...
...
(series of codes)
...
...
...
RETURN

sample_label:

...
...
...
(do some other stuff)
...
...

it works like an ON ERROR GOTO command in VISUAL BASIC. Do we have this kind of procedure in VFP.

or is there any other way on how can i achieve this kind of code structure.

thanks guys!!!

 


(start of code)
...
...
...
(do something here)
...
...
if (condition)
DO sample_label
else
(do something again)
endif

(series of codes)

PROCEDURE sample_label
(do some other stuff)
ENDPROC


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You can:
ON ERROR DO MyErrorHandler

where MyErrorHandle is a procedure

PROCEDURE MyErrorHandler
... code here
 
ellehcsim,

You can't use GOTO in VFP to branch to another line of the program. For error handling, you need ON ERROR.

GOTO does something quite different in VFP: it moves the record pointer to a particular record number.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
yes, does that PROCEDURE can be placed inside an EVENT? let say for example, can i include that PROCEDURE inside the BUTTON CLICK EVENT?

THANKS AGAIN!
 
, can i include that PROCEDURE inside the BUTTON CLICK EVENT?

No. You can't put PROCEDURE ... ENDPROC (or FUNCTION .. ENDFUNC) inside event code (or any other method code). But you can put it in a PRG, and still call it from the event code.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top