Skip to main content

Is there a demo that shows how to capture runtime errors in .NET?

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

If a program has a long running block of code that adds items to a listbox or listview then the User Interface does not reflect the changes until the code has completed.

Is it possible to update the control while the processing takes place ?

Resolution:

This occurs because all the processing is taking place on the same thread as the user interface. While the COBOL is processing data and adding items to a listbox the user interface will not respond as the Windows message Q is not being processed.

The simplest mechanism to do this is by calling the "DoEvents" on the Application class at various points in the code. This will ensure that the Windows message Q will be processed at that point to reflect changes in your user interface.

A more complex approach would be run the COBOL processing on a seperate thread from the user interface. This will ensure that the user interface is responsive while the COBOL processing takes place.

Old KB# 5296

0 replies

Be the first to reply!