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. MultiThread

MultiThread

Scheduled Pinned Locked Moved Visual Basic
comquestion
14 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.
  • C codeadair

    i need to read data from a equipment continuously. EM! I have found the reason.i evaluate data to a control of form. And how can i avoid the problem? ICQ:258-235-734 MSN:msnadair@hotmail.com

    N Offline
    N Offline
    Nibu babu thomas
    wrote on last edited by
    #4

    codeadair wrote:

    need to read data from a equipment continuously. EM! I have found the reason.i evaluate data to a control of form. And how can i avoid the problem?

    While(bThreadRunning)

    'thread stuff
    ....
    Thread.Sleep(someMilliSeconds);

    End While


    Nibu thomas A Developer Programming tips[^]  My site[^]

    C 1 Reply Last reply
    0
    • N Nibu babu thomas

      codeadair wrote:

      need to read data from a equipment continuously. EM! I have found the reason.i evaluate data to a control of form. And how can i avoid the problem?

      While(bThreadRunning)

      'thread stuff
      ....
      Thread.Sleep(someMilliSeconds);

      End While


      Nibu thomas A Developer Programming tips[^]  My site[^]

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

      i think i get you. you want to give some milliseconds to the free-time thread that counts the left time of CPU.Therefore CPU use will not be 100%. Thank you for your bright idea. I evalue the data (read from equipment) to form control (textbox).As below: textbox1.text=str.tostring.trim 'str is the data If i alter it to: console.writeline(str.tostring.trim) The cpu use will reduce to 1% more or less. How could i transfer the data to a form control without hige cpu usage? Maybe we could be mailfriends. Contact me by MSN as below Regards. ICQ:258-235-734 MSN:msnadair@hotmail.com -- modified at 6:11 Thursday 25th May, 2006

      N 1 Reply Last reply
      0
      • C codeadair

        i think i get you. you want to give some milliseconds to the free-time thread that counts the left time of CPU.Therefore CPU use will not be 100%. Thank you for your bright idea. I evalue the data (read from equipment) to form control (textbox).As below: textbox1.text=str.tostring.trim 'str is the data If i alter it to: console.writeline(str.tostring.trim) The cpu use will reduce to 1% more or less. How could i transfer the data to a form control without hige cpu usage? Maybe we could be mailfriends. Contact me by MSN as below Regards. ICQ:258-235-734 MSN:msnadair@hotmail.com -- modified at 6:11 Thursday 25th May, 2006

        N Offline
        N Offline
        Nibu babu thomas
        wrote on last edited by
        #6

        codeadair wrote:

        How could i transfer the data to a form control without hige cpu usage?

        I don't know what you are saying. I have never experienced this. How could CPU usage go up when you are updating the value of a control. Just a min, what is the size of str. Is it too big a string. Edit controls only take a max of 64KB. (:~ ) So if the string size is more that this then frequent updations could lead to 100% CPU usage.


        Nibu thomas A Developer Programming tips[^]  My site[^]

        C 1 Reply Last reply
        0
        • N Nibu babu thomas

          codeadair wrote:

          How could i transfer the data to a form control without hige cpu usage?

          I don't know what you are saying. I have never experienced this. How could CPU usage go up when you are updating the value of a control. Just a min, what is the size of str. Is it too big a string. Edit controls only take a max of 64KB. (:~ ) So if the string size is more that this then frequent updations could lead to 100% CPU usage.


          Nibu thomas A Developer Programming tips[^]  My site[^]

          C Offline
          C Offline
          codeadair
          wrote on last edited by
          #7

          Nibu thomas wrote:

          Just a min, what is the size of str. Is it too big a string. Edit controls only take a max of 64KB. () So if the string size is more that this then frequent updations could lead to 100% CPU usage

          thanks for your reply integer number. the range is 0~20000. ICQ:258-235-734 MSN:msnadair@hotmail.com

          C N 2 Replies Last reply
          0
          • C codeadair

            Nibu thomas wrote:

            Just a min, what is the size of str. Is it too big a string. Edit controls only take a max of 64KB. () So if the string size is more that this then frequent updations could lead to 100% CPU usage

            thanks for your reply integer number. the range is 0~20000. ICQ:258-235-734 MSN:msnadair@hotmail.com

            C Offline
            C Offline
            codeadair
            wrote on last edited by
            #8

            Well! The important point is we can't update the form control value(as textbox) in a thread ---a network friend says ICQ:258-235-734 MSN:msnadair@hotmail.com

            N 1 Reply Last reply
            0
            • C codeadair

              Nibu thomas wrote:

              Just a min, what is the size of str. Is it too big a string. Edit controls only take a max of 64KB. () So if the string size is more that this then frequent updations could lead to 100% CPU usage

              thanks for your reply integer number. the range is 0~20000. ICQ:258-235-734 MSN:msnadair@hotmail.com

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #9

              codeadair wrote:

              thanks for your reply integer number. the range is 0~20000.

              Then I am not sure what's going on.

              codeadair wrote:

              i need to read data from a equipment continuously.

              Is this the problem? How much time does it take to interface with this equipment?


              Nibu thomas A Developer Programming tips[^]  My site[^]

              C 1 Reply Last reply
              0
              • N Nibu babu thomas

                codeadair wrote:

                thanks for your reply integer number. the range is 0~20000.

                Then I am not sure what's going on.

                codeadair wrote:

                i need to read data from a equipment continuously.

                Is this the problem? How much time does it take to interface with this equipment?


                Nibu thomas A Developer Programming tips[^]  My site[^]

                C Offline
                C Offline
                codeadair
                wrote on last edited by
                #10

                Nibu thomas wrote:

                Is this the problem? How much time does it take to interface with this equipment?

                1ms ICQ:258-235-734 MSN:msnadair@hotmail.com

                1 Reply Last reply
                0
                • C codeadair

                  Well! The important point is we can't update the form control value(as textbox) in a thread ---a network friend says ICQ:258-235-734 MSN:msnadair@hotmail.com

                  N Offline
                  N Offline
                  Nibu babu thomas
                  wrote on last edited by
                  #11

                  codeadair wrote:

                  The important point is we can't update the form control value(as textbox) in a thread ---a network friend says

                  That's true. :)


                  Nibu thomas A Developer Programming tips[^]  My site[^]

                  C 1 Reply Last reply
                  0
                  • N Nibu babu thomas

                    codeadair wrote:

                    The important point is we can't update the form control value(as textbox) in a thread ---a network friend says

                    That's true. :)


                    Nibu thomas A Developer Programming tips[^]  My site[^]

                    C Offline
                    C Offline
                    codeadair
                    wrote on last edited by
                    #12

                    Nibu thomas wrote:

                    codeadair wrote: The important point is we can't update the form control value(as textbox) in a thread ---a network friend says That's true.

                    I need to display the data to user.And how could i deal with it? Do be grateful for your help ICQ:258-235-734 MSN:msnadair@hotmail.com

                    N 1 Reply Last reply
                    0
                    • C codeadair

                      Nibu thomas wrote:

                      codeadair wrote: The important point is we can't update the form control value(as textbox) in a thread ---a network friend says That's true.

                      I need to display the data to user.And how could i deal with it? Do be grateful for your help ICQ:258-235-734 MSN:msnadair@hotmail.com

                      N Offline
                      N Offline
                      Nibu babu thomas
                      wrote on last edited by
                      #13

                      codeadair wrote:

                      I need to display the data to user.And how could i deal with it?

                      You need to use a delegate to invoke a method on an object not created by your thread. Sometime back I had the same problem showing a custom dialog sometime back from a different thread. But fixed it later using delegates. Don't remember the exact thing.:doh: It's been a long time. :)


                      Nibu thomas A Developer Programming tips[^]  My site[^]

                      C 1 Reply Last reply
                      0
                      • N Nibu babu thomas

                        codeadair wrote:

                        I need to display the data to user.And how could i deal with it?

                        You need to use a delegate to invoke a method on an object not created by your thread. Sometime back I had the same problem showing a custom dialog sometime back from a different thread. But fixed it later using delegates. Don't remember the exact thing.:doh: It's been a long time. :)


                        Nibu thomas A Developer Programming tips[^]  My site[^]

                        C Offline
                        C Offline
                        codeadair
                        wrote on last edited by
                        #14

                        Yes!Sometime ago the idea flash over my brain due to internet article. OK! i will try the idea! Thank you! ICQ:258-235-734 MSN:msnadair@hotmail.com -- modified at 8:21 Thursday 25th May, 2006

                        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