Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Easy Question!!!!!

Posted on 2000-03-21
4
Medium Priority
?
215 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
  • 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 600 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

Independent Software Vendors: 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

916 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