After clicking on a button, I show a progress form and start a task. I want to disable the button or make the progress form a modal so nothing should clickable on the main form, till the progress is completed.
I Tried passing owner reference as an argument when calling the progress bar form's ShowDialog:
m_oProgressBarForm = new ProgressBarForm(); m_oProgressBarForm.ShowDialog(this); Please help how can I prevent users to click on button again by graying out the main window or making the buttons not clickable or making the progress bar window as the modal?
Currently the user can click the button again and another instance starts which makes the application not usable, and have to manually kill the application using task manager.
ShowDialog()the next line of code after theShowDialogwill execute after the dialog closed, while you probably need to show loading and the perform some operations and then close the form.