Solved

Easy Question!!!!!

Posted on 2000-03-21
4
203 Views
Last Modified: 2010-05-02
In Delphi we can write :

For cpt := 1 to 10 do
begin
  if (condition) then
    continue; //bypass (do something)
  (do something)
end;

How can I do this with VB????
0
Comment
Question by:HellSlayer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Jagar
ID: 2641495
for p = 1 to 10
   if (condition) then
      exit for
   end if
next p
0
 
LVL 2

Accepted Solution

by:
Jagar earned 200 total points
ID: 2641502
That was supposed to be an answer.
You could also do p = 11 in between if and end if.  If you want the program to execute the rest of the for statement until it gets back to the for statement.
0
 

Author Comment

by:HellSlayer
ID: 2641555
I don't realy want to "Exit" the For.
I just want to jump to the next value...
0
 

Expert Comment

by:rdolivaw
ID: 2641561
Try:

For cpt = 1 to 10
  If Not (condition) then
      (do something)
  End If
Next cpt

This will (do something) each time (condition) is false.

Or, if you need to drop out of the For/Next loop when (condition):

For cpt = 1 to 10
   If (condition) then
      Exit For
   End If
   (do something)
Next cpt

This will (do something) until (condition) is true.

Variation:

   If Not (condition) then
       (do something)
   Else
      Exit For
   End If
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question