Screen display at long term program running

Hans-Peter Bittner 116 Reputation points
2021-08-04T16:31:35.567+00:00

Windows 10, VS 2013 Prof, C#. I have a program function which generates screen output in a loop.

this.textbox.Text = mytext;
this.textbox.Refresh();

When the loop is running for 3 minutes, all screen output is visible. But when the loop runs for 7 hours, it seems that the screen is no longer updated after about 6 hours. What can I do to get all screen output visible?

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Hans-Peter Bittner 116 Reputation points
    2021-08-05T14:08:31.037+00:00

    @Karen Payne MVP
    Excuse me that I cannot show you the complete source code, because my project is too complex (117 MB), I can only explain to you the logical structure of the relevant part in words.

    In the original version (EXE) with certain loop-parameters the visible updating of screen output stopped at 88% of loop progress, although the loop-execution was continued up to 100%.

    In the test version (Debugger) I only added an try/catch-instruction around the loop and started execution with the same loop-parameters. Now all screen output was visible up to 100% of loop-progress. I wonder about this difference in behaviour between original and test version.

    //New structure (simplified):
    int counter = 0;
    try
    {
    //Set loop-parameters, int limit = number
    while (counter < limit)
    {
    //Do 1 new step of complex math work
    counter++;
    //Determine progress ratio counter/limit in percent --> out string mytext
    //Display mytext
    }
    }
    catch
    {
    //MessageBox: "Loop stopped because of exception at counter = " + Convert.ToString(counter);
    }

    With this try/catch-block (scheme) no exception and no memory issue were found.
    The normal execution time of the loop may be approx. 7 hours.
    How can you explain this to me?

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.