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. C#
  4. Pausing A Loop in Windows Application

Pausing A Loop in Windows Application

Scheduled Pinned Locked Moved C#
algorithmsdata-structureshelpworkspace
8 Posts 5 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.
  • I Offline
    I Offline
    Ian Uy
    wrote on last edited by
    #1

    Good Day Sir/Maam, I am making a program to SIMULATE different sorting algrothims such as bubble sort, insertion sort, straight sort and quick sort. This program is for EDUCATIONAL PURPOSES. (EG: Show students how the algorithim works) The setup was, the program will ask the user for the LIST SIZE (Array Size), then the program will ask the values for the array then it will sort the array. I used a list view to show a table of VARIABLES and the LIST. (Like high school simulation) :) The problem is, I need to "pause" the loop on every pass. Like in a console app, I put getch() to pause the loop on every pass. What I want is, after each pass, the LOOP will pause, and there is a command button that needs to be clicked to continue the loop again for 1 pass. Then pause again. I hope I did not confused you with my english. :( Thank you great masters. :D

    M N C P 4 Replies Last reply
    0
    • I Ian Uy

      Good Day Sir/Maam, I am making a program to SIMULATE different sorting algrothims such as bubble sort, insertion sort, straight sort and quick sort. This program is for EDUCATIONAL PURPOSES. (EG: Show students how the algorithim works) The setup was, the program will ask the user for the LIST SIZE (Array Size), then the program will ask the values for the array then it will sort the array. I used a list view to show a table of VARIABLES and the LIST. (Like high school simulation) :) The problem is, I need to "pause" the loop on every pass. Like in a console app, I put getch() to pause the loop on every pass. What I want is, after each pass, the LOOP will pause, and there is a command button that needs to be clicked to continue the loop again for 1 pass. Then pause again. I hope I did not confused you with my english. :( Thank you great masters. :D

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      You can use a message box instead. :rose:

      I 1 Reply Last reply
      0
      • M Manas Bhardwaj

        You can use a message box instead. :rose:

        I Offline
        I Offline
        Ian Uy
        wrote on last edited by
        #3

        Yeah, but its not as clean like the command button option. Thanks.

        1 Reply Last reply
        0
        • I Ian Uy

          Good Day Sir/Maam, I am making a program to SIMULATE different sorting algrothims such as bubble sort, insertion sort, straight sort and quick sort. This program is for EDUCATIONAL PURPOSES. (EG: Show students how the algorithim works) The setup was, the program will ask the user for the LIST SIZE (Array Size), then the program will ask the values for the array then it will sort the array. I used a list view to show a table of VARIABLES and the LIST. (Like high school simulation) :) The problem is, I need to "pause" the loop on every pass. Like in a console app, I put getch() to pause the loop on every pass. What I want is, after each pass, the LOOP will pause, and there is a command button that needs to be clicked to continue the loop again for 1 pass. Then pause again. I hope I did not confused you with my english. :( Thank you great masters. :D

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Use a ManualResetEvent that is triggered by the button click


          only two letters away from being an asset

          I 1 Reply Last reply
          0
          • I Ian Uy

            Good Day Sir/Maam, I am making a program to SIMULATE different sorting algrothims such as bubble sort, insertion sort, straight sort and quick sort. This program is for EDUCATIONAL PURPOSES. (EG: Show students how the algorithim works) The setup was, the program will ask the user for the LIST SIZE (Array Size), then the program will ask the values for the array then it will sort the array. I used a list view to show a table of VARIABLES and the LIST. (Like high school simulation) :) The problem is, I need to "pause" the loop on every pass. Like in a console app, I put getch() to pause the loop on every pass. What I want is, after each pass, the LOOP will pause, and there is a command button that needs to be clicked to continue the loop again for 1 pass. Then pause again. I hope I did not confused you with my english. :( Thank you great masters. :D

            C Offline
            C Offline
            CiNN
            wrote on last edited by
            #5

            make a recursive function and use a variable as the incrementer and in the button method increment the variable and call the function.

            1 Reply Last reply
            0
            • I Ian Uy

              Good Day Sir/Maam, I am making a program to SIMULATE different sorting algrothims such as bubble sort, insertion sort, straight sort and quick sort. This program is for EDUCATIONAL PURPOSES. (EG: Show students how the algorithim works) The setup was, the program will ask the user for the LIST SIZE (Array Size), then the program will ask the values for the array then it will sort the array. I used a list view to show a table of VARIABLES and the LIST. (Like high school simulation) :) The problem is, I need to "pause" the loop on every pass. Like in a console app, I put getch() to pause the loop on every pass. What I want is, after each pass, the LOOP will pause, and there is a command button that needs to be clicked to continue the loop again for 1 pass. Then pause again. I hope I did not confused you with my english. :( Thank you great masters. :D

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              You asked this question 2 days ago. People answered you in that post - if you have problems with the solutions that people presented then, you should have the courtesy to reply to them on THAT post.

              Deja View - the feeling that you've seen this post before.

              1 Reply Last reply
              0
              • N Not Active

                Use a ManualResetEvent that is triggered by the button click


                only two letters away from being an asset

                I Offline
                I Offline
                Ian Uy
                wrote on last edited by
                #7

                Sir, Please elaborate? Thanks.

                N 1 Reply Last reply
                0
                • I Ian Uy

                  Sir, Please elaborate? Thanks.

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #8

                  http://msdn2.microsoft.com/en-us/library/system.threading.manualresetevent.aspx[^]


                  only two letters away from being an asset

                  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