Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


C# Forms UI Thread
Events in a Windows Form in C# are triggered as soon as the object is pressed. Code will be run without break as long as System.Windows.Forms.Application.DoEvents() isn't called. Once DoEvents() is called, the UI events are processed that the user may have clicked during processing. These are then run concurrently with whatever code is still running. So, if code blocks need to be run sequentially or in a certain order (not concurrently), you need a flag that reads 'true' during processing. If an event is triggered while it is 'true', cancel the event or wait until the flag reads 'false'. Better yet, disable all input buttons during processing so the user doesn't click on them.

Created By: amos 1/26/2006 9:08:36 PM