One thing is that you try to minimize the time that is taken to load the file and this way make the UI to feel more responsive. But another question is why you want to block access to the UI while loading the data.
The unresponsiveness is caused by the fact that you're doing something else in the thread that runs the UI and that thread cannot respond to any event that is sent to the UI. So if you want your application remain responsive while loading the data, a solution is to load the data in another thread.
So why not
- When loading starts, disable the richtextbox. This way no-one can make modifications to the control
- Do the data loading from the file in another thread, for example using
BackgroundWorker Class (System.ComponentModel)[
^]
- After loading is finished, update the content of the richtextbox
- Enable the richtextbox again
This way your UI could do other operations while the file is loading in the background.