calendar control

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I have a calendar control that has runs a longish bit of code in the
ValueChanged event.

How do I get the control to repaint before running the code.

At the moment the calendar month view stays active while the code is
running.

Thanks in advance

VS 2005 / C# / CF2
 
Hi Dave,

What you require is asynchronous processing. You'll have to run the time-consuming code in another thread to free the UI thread.
You'll want to start a "background" process and handle an event when the process completes. You might need to disable (set
Enabled=false) certain UI components before running code on another thread and returning so that while your code is working in the
background your end-users won't be able to change their state. For instance, while processing the ValueChanged event for the
Calendar, you'll probably want the Calendar to be disabled until the process completes; however, you'll want the entire application
responsive to user interaction, including the painting of the calendar control, which is accomplished by freeing the UI thread and
running the time-consuming code in a background process as I suggested.

Check out the BackgroundWorker class.

BackgroundWorker on MSDN:
http://msdn2.microsoft.com/en-us/library/8xs8549b.as
 
Back
Top