View Single Post
Old 04-11-2007, 08:03 AM   #1 (permalink)
wolf99
Code Monkey
 
wolf99's Avatar
 
Join Date: Jan 2006
Location: in college (again) in rural Eire
Posts: 44
wolf99 is on a distinguished road
control flow in nested loops

(I put this into this fourm as it is pretty much relevant to most languages.)

I am using VB6
and have a IF loop.

If scannedDataCorrect Then
..do something
..ClFrmSub
Else
..Error

now my ClFrmSub subroutine is supposed to clear scan field, then return focus to it.
the problem is that of cxourse as the field is cleared, it no longer contains the correct data and when the sub routine returns program flow drops into the "Else" and I get the error message

I dont think there is a way that the subroutine could break out of the IF while retaining control itself so that it can return to the next bit of the program.
Maybe Im missing something, but I think all conditional "switchs" or "loops" must return to their end instruction to properly run.

Is this true for all cases?
__________________
wolf99 is offline   Reply With Quote