|
Hi
I am creating a search application in .net framework 1.1. The search is controlled by a button (similar to file search operation of windows). Actual search operartion, i.e. getting data from database, is executed on another thread, say SearchThread.After getting the data, SearchThreadhas to display the searched data. The ListView that is used to display the searched data is created on the UI thread (i.e. main thread), and not on the SearchThread.So to have thread safe method calls, SearchThread uses InvokeRequired and Invoke to pass the displaying of search data to the UI thread. Then UI thread starts executing the method to display the data received from SearchThread. The problem I am facing is that, since the display of search data is running on UI thread (and also it is time taking process because of bulk data), any other events triggered on the UI thread dont get processed until the current displaying process is over. This is because the events get posted to the message queue and cannot be processed until search data display has been completed. But because of this for any control that I click on UI like Stop button or any search criteria selection button, event dont get executed immediately. I need to correct this behavior of my search application.
I need help from anyone to fix this issue. Probably I need some mechanism to execute the events in UI thread (on an emergency basis to ignore any currently running heavy processing of the UI thread). Or anything else....
Please help!
|