Yielding time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Chandler

    Yielding time

    Greetings to All,

    I have a c# conversion app that does a lot of crunching and updates a status
    window containing a RichText control. The updates to the control do not
    appear until the job is done and the processor is freed up. I know in C++
    you could pump some messages and the update would happen. I know in VB,
    they had a call which would yield a minimum amount of time in order to
    process events and update the display. What is available in C#?

    Thanks in advance,
    Kevin


  • Jon Skeet

    #2
    Re: Yielding time

    Kevin Chandler <KevinC@CoaxNoS pam.Net> wrote:[color=blue]
    > I have a c# conversion app that does a lot of crunching and updates a status
    > window containing a RichText control. The updates to the control do not
    > appear until the job is done and the processor is freed up. I know in C++
    > you could pump some messages and the update would happen. I know in VB,
    > they had a call which would yield a minimum amount of time in order to
    > process events and update the display. What is available in C#?[/color]

    You should start the work in another thread, leaving the UI thread for
    UI events. Note that any status updates or whatever should occur in the
    UI thread too - use Control.Invoke to easily achieve this.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Kevin Chandler

      #3
      Re: Yielding time

      Thanks!

      It worked great. I should have known better. Suffering from a brain-fade.

      Kevin


      Comment

      • Paul E Collins

        #4
        Re: Yielding time

        "Kevin Chandler" <KevinC@CoaxNoS pam.Net> wrote:
        [color=blue]
        > I have a c# conversion app that does a lot of
        > crunching and updates a status window
        > containing a RichText control. [...]
        > I know in VB, they had a call which would yield
        > a minimum amount of time in order to process
        > events and update the display.[/color]

        If you don't want to go the multi-threaded route, you can still use DoEvents
        as you did in VB. The equivalent C# call is Application.DoE vents().

        P.

        --



        Comment

        Working...