There is a process in the project I wrote. It takes time, and I want to use a progress bar. I want to allow the user to cancel the process and the ProgressBar by clicking a button. I do not want the user to be able to click any other controls on that form when my process is running. If I use a thread, then the user can click other controls on the form.
Perhaps one solution is to use another form, and set the ProgressBar and cancel button on the second form. But how can I set the value of the ProgressBar according my process, which is taking part on the first form.
What’s the solution?
Thanks in advance.
Use BackgroundWorker for that. Add it to your first form and on BackgroundWorker progress changed event change progress bars value. Look at example shown in documentation.