This is a standard thread problem. Even if you can block events, it’s very difficult to do, it still won’t solve the problem. Since the event handler can be started, but not yet finished, by the time you want to start the lock.
And it has a standard solution, use the lock keyword.
If this is impractical because the user needs to change several controls before you can run the query again, you need to complete the workflow first. For example, BackgroundWorker.CancelAsync. If this is impractical because it takes too much time to cancel the request, you need to set the Enabled property to false while the request is running.
source share