Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > Program Design and Methods
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
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: 45
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
Old 04-12-2007, 03:02 AM   #2 (permalink)
wolf99
Code Monkey
 
wolf99's Avatar
 
Join Date: Jan 2006
Location: in college (again) in rural Eire
Posts: 45
wolf99 is on a distinguished road
looking at that again today with a fresh cupp o joe, I realised of course that I could just re arange like so

If scannedDataCorrect Then
..do something
Else
..Error
..Jump to label
End If

ClFrmSub
Label:

prob abetter way again. funny how simple things look after spending an hr or 2 away from the pc
__________________
wolf99 is offline   Reply With Quote
Old 04-12-2007, 09:35 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,398
sde is on a distinguished road
Quote:
Originally Posted by wolf99 View Post
prob abetter way again. funny how simple things look after spending an hr or 2 away from the pc
hah so true, .. i burned about 10 hours trying to get wifi working on my ubuntu feisty install.

the next day i found the issue in 5 minutes.
__________________
testing 1 2 3
sde is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
web control sureshkumar_kc MS Technologies ( ASP, VB, C#, .NET ) 2 09-28-2004 05:58 AM
Version Control Netrunner Lounge 7 03-07-2003 05:42 AM


All times are GMT -8. The time now is 02:51 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle