473,246 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

force next iteration in for...next

Is there any way in VB to force the next iteration in a For ... next loop
other than
using a GoTo?

I notice that in C++ you can use 'continue' and in other languages there are
syntax for this. Am I missing something?

For an example, if a = false I don't want the if b = true to execute.

for i = 1 to 10

if a = true
do stuff
else
'go to next iteration
end if

if b = true
do some more stuff
end if
next i

TIA,
Marc Miller

May 15 '06 #1
2 3527
"Marc Miller" <mm****@hotmail.com> schrieb:
Is there any way in VB to force the next iteration in a For ... next loop
other than
using a GoTo?


In VB.NET 2002/2003 you may want to use 'GoTo' together with a named label.
In VB.NET you can simply use 'Continue' or 'Continue For', depending on the
situation.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 15 '06 #2
> Is there any way in VB to force the next iteration in a For ... next
loop
other than
using a GoTo?
I notice that in C++ you can use 'continue' and in other languages
there are syntax for this. Am I missing something?

For an example, if a = false I don't want the if b = true to execute.

for i = 1 to 10

if a = true
do stuff
else
'go to next iteration
end if
if b = true
do some more stuff
end if
next i
TIA,
Marc Miller


VB 2005 introduced the Continue statement in VB. See http://msdn2.microsoft.com/en-us/library/801hyx6f.aspx.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
May 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: Raymond Hettinger | last post by:
Here is a discussion draft of a potential PEP. The ideas grew out of the discussion on pep-284. Comments are invited. Dart throwing is optional. Raymond Hettinger ...
2
by: Abdullah Khaidar | last post by:
Is there any iteration style we must use to get faster processing time? I've tried with some style to concat number in list. But I still don't know which one is the recommended style. >>> def...
10
by: Brian Burgess | last post by:
Hi all, Is there any 'trick' anyone knows to control a For Next to pass to the next iteration in ASP VBScript? ..Similar to the 'continue' keyword of C and C++? Thanks in advance.. -BB
1
by: DottingTheNet | last post by:
Hi ppl!! just a newbie ques is there something in PL/SQL that skips to the next iteration in the for loop like a next, etc.???? Thnx!!
1
by: aj | last post by:
DB2 v8 FP5 Red Hat AS/EL 2.1 For disaster recovery purposes (I'm in FL), I am utilizing a custom DB2 userexit to FTP logical logs to an alternate site in prep for a potential restore and roll...
23
by: Mitchell Vincent | last post by:
Is there any way to "skip" iterations in a for loop? Example : for x = 1 to 10 if something = 1 next endif
9
by: paul c | last post by:
Apologies if I'm sending this to the wrong group. If so I'd be grateful if somebody could point me to the right one. I'm using microsoft visual c++ 6.0 compiler. My code is C, I just use the...
4
by: Steve | last post by:
C# I am iterating through a collection of rows thus: foreach(DataRow myRow in dsTable.Table.Rows) { ........... } in this loop I have some conditions and when one is met I dont want it to
11
by: estantep | last post by:
Hello, I am trying to find out an alternate way to brute-force a variable length vector with different variable length contents. int chromossome int max_value_for_each_chromossome
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.