Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to break/continue a for loop? [modified]

how to break/continue a for loop? [modified]

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mimimimilaw
    wrote on last edited by
    #1

    "end for" can break a for loop. but how to continue a for? for example: For i =0 to 10 if(i =4) continue Response.write(i) Next the result should be: 012356789 But how to do it in vb?? -- modified at 5:30 Thursday 17th August, 2006

    C H S 3 Replies Last reply
    0
    • M mimimimilaw

      "end for" can break a for loop. but how to continue a for? for example: For i =0 to 10 if(i =4) continue Response.write(i) Next the result should be: 012356789 But how to do it in vb?? -- modified at 5:30 Thursday 17th August, 2006

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      That looks like perfectly good VB to me, except that I thought you needed 'then' and continue on the same line, unless you put end for. Another way would be if (i<>4) then Response.Write(i)

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      • M mimimimilaw

        "end for" can break a for loop. but how to continue a for? for example: For i =0 to 10 if(i =4) continue Response.write(i) Next the result should be: 012356789 But how to do it in vb?? -- modified at 5:30 Thursday 17th August, 2006

        H Offline
        H Offline
        hannesHTG
        wrote on last edited by
        #3

        mimimimilaw wrote:

        "end for" can break a for loop.

        Hmm, isn't that Exit For ¿¿

        1 Reply Last reply
        0
        • M mimimimilaw

          "end for" can break a for loop. but how to continue a for? for example: For i =0 to 10 if(i =4) continue Response.write(i) Next the result should be: 012356789 But how to do it in vb?? -- modified at 5:30 Thursday 17th August, 2006

          S Offline
          S Offline
          Sujith C Jose
          wrote on last edited by
          #4

          If you have a textbox named Text1 in your form(VB), then this will do the job For i=0 To 10 If i=4 then GoTo ss End If Text1.Text=Text1.Text & i ss: Next

          sujithcjose@yahoo.com http://www.sujith.cjb.net

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups