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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Repaint causes CPU loading and failed test

Repaint causes CPU loading and failed test

Scheduled Pinned Locked Moved Visual Basic
helpquestion
5 Posts 2 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.
  • V Offline
    V Offline
    VFaul
    wrote on last edited by
    #1

    I have a form with a tab control with several tabs. The main tab has many controls on it. The app is performing various "tests" and displaying pass/fail in the main tab. One of the tests is a communication test. It sends out a message and expects an asynchronous reply within a certain timeout. When I click on a tab and then go back to the main tab, it takes almost a second for all the controls to be repainted. This causes the CPU to peg at 100% usage and will occasionally cause my communication test to timeout (the timer expires before the reply is received). Does anyone have any ideas to get around this problem? I have already increased the timeout period as much as I want to. I also do not want to disable the test when I switch tabs. Thanks VF

    K 1 Reply Last reply
    0
    • V VFaul

      I have a form with a tab control with several tabs. The main tab has many controls on it. The app is performing various "tests" and displaying pass/fail in the main tab. One of the tests is a communication test. It sends out a message and expects an asynchronous reply within a certain timeout. When I click on a tab and then go back to the main tab, it takes almost a second for all the controls to be repainted. This causes the CPU to peg at 100% usage and will occasionally cause my communication test to timeout (the timer expires before the reply is received). Does anyone have any ideas to get around this problem? I have already increased the timeout period as much as I want to. I also do not want to disable the test when I switch tabs. Thanks VF

      K Offline
      K Offline
      KevinMac
      wrote on last edited by
      #2

      Just brainstorming but I would think about threading the UI and try to get a lazier load if possible. Here are the articles I have used

      K V 2 Replies Last reply
      0
      • K KevinMac

        Just brainstorming but I would think about threading the UI and try to get a lazier load if possible. Here are the articles I have used

        K Offline
        K Offline
        KevinMac
        wrote on last edited by
        #3

        Messed up the links ^ ^

        1 Reply Last reply
        0
        • K KevinMac

          Just brainstorming but I would think about threading the UI and try to get a lazier load if possible. Here are the articles I have used

          V Offline
          V Offline
          VFaul
          wrote on last edited by
          #4

          You were correct! I was doing everything inside the UI thread. I redesigned the app to use threads for each of my tests. Now the test never fails, even when the CPU is maxed at 100%!!!

          K 1 Reply Last reply
          0
          • V VFaul

            You were correct! I was doing everything inside the UI thread. I redesigned the app to use threads for each of my tests. Now the test never fails, even when the CPU is maxed at 100%!!!

            K Offline
            K Offline
            KevinMac
            wrote on last edited by
            #5

            Great to hear did you get a chance to work with the background worker object or did you write your own threading class?

            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