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. Show Counter Runtime

Show Counter Runtime

Scheduled Pinned Locked Moved C#
tutorial
5 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.
  • P Offline
    P Offline
    PavanPareta
    wrote on last edited by
    #1

    Hi all, I have write a program for showing added records, couter. but it does not working/showing during the for loop execution. after stoped loop it will show. but i want to show it as continue (1,2,3 ... 50000). for (intCounter = 1; intCounter;= 50000; intCounter++) { lblShowCount.Text = intCounter.ToString(); oEmployee.AddRecord(); } Please guide me what would be the better approch for showing continue Counter during the loop execution

    Pavan Pareta

    C F P 3 Replies Last reply
    0
    • P PavanPareta

      Hi all, I have write a program for showing added records, couter. but it does not working/showing during the for loop execution. after stoped loop it will show. but i want to show it as continue (1,2,3 ... 50000). for (intCounter = 1; intCounter;= 50000; intCounter++) { lblShowCount.Text = intCounter.ToString(); oEmployee.AddRecord(); } Please guide me what would be the better approch for showing continue Counter during the loop execution

      Pavan Pareta

      F Offline
      F Offline
      fearless stallion
      wrote on last edited by
      #2

      this will do.... for (intCounter = 1; intCounter;= 50000; intCounter++) { lblShowCount.Text = intCounter.ToString(); **Application.DoEvents();** oEmployee.AddRecord(); }

      KSS

      1 Reply Last reply
      0
      • P PavanPareta

        Hi all, I have write a program for showing added records, couter. but it does not working/showing during the for loop execution. after stoped loop it will show. but i want to show it as continue (1,2,3 ... 50000). for (intCounter = 1; intCounter;= 50000; intCounter++) { lblShowCount.Text = intCounter.ToString(); oEmployee.AddRecord(); } Please guide me what would be the better approch for showing continue Counter during the loop execution

        Pavan Pareta

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

        Calling Application.DoEvents is the easy way to fix this. Putting the AddRecord call in another thread, and having the end of the thread call fire a new one, is the better way.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        G 1 Reply Last reply
        0
        • P PavanPareta

          Hi all, I have write a program for showing added records, couter. but it does not working/showing during the for loop execution. after stoped loop it will show. but i want to show it as continue (1,2,3 ... 50000). for (intCounter = 1; intCounter;= 50000; intCounter++) { lblShowCount.Text = intCounter.ToString(); oEmployee.AddRecord(); } Please guide me what would be the better approch for showing continue Counter during the loop execution

          Pavan Pareta

          P Offline
          P Offline
          PavanPareta
          wrote on last edited by
          #4

          Thanks It is very useful. :)

          Pavan Pareta

          1 Reply Last reply
          0
          • C Christian Graus

            Calling Application.DoEvents is the easy way to fix this. Putting the AddRecord call in another thread, and having the end of the thread call fire a new one, is the better way.

            Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            G Offline
            G Offline
            Gareth H
            wrote on last edited by
            #5

            I thought doing 'Application.DoEvents();' was bad practice? Regards, Gareth.

            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