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. Interrupt loop operation

Interrupt loop operation

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
3 Posts 3 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.
  • N Offline
    N Offline
    normanordas
    wrote on last edited by
    #1

    How can i interrupt a loop operation? Example im iterating over all the records of a 100,000 datareader however i decided to cut short the iteration by clicking a Stop button. How do i do that?

    T B 2 Replies Last reply
    0
    • N normanordas

      How can i interrupt a loop operation? Example im iterating over all the records of a 100,000 datareader however i decided to cut short the iteration by clicking a Stop button. How do i do that?

      T Offline
      T Offline
      thesleeper
      wrote on last edited by
      #2

      you can set a temp var dim tmp as boolean when you press the button set it to true in the while code use this while tmp = true ... end while

      1 Reply Last reply
      0
      • N normanordas

        How can i interrupt a loop operation? Example im iterating over all the records of a 100,000 datareader however i decided to cut short the iteration by clicking a Stop button. How do i do that?

        B Offline
        B Offline
        beowulfagate
        wrote on last edited by
        #3

        You add a variable that you check within the loop. Exapmle: dim b as boolean as boolean dim i as long for i=0 to i=1000 if b=true then exit for end if next i you change the value of b somewhere else in your code, probably in the "Stop" Button event. You may also want to consider concurrency issues on that variable. Good Luck.

        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