C# Forms: Lock Main form and process another form
I want to create something like this.
When the button clicks main form will lock/disable/inaccessible. Then the another form load and do some processing. (actually when the button clicked, it will read some text from a file and write to db. I put progress bar to give a nice look)
As I said I want to lock/disable/inaccessible main form and l开发者_JAVA百科oad the another form.
How can I do this ?
Please Help Yohan
new Form().ShowDialog()
will do just that.
oldForm.Hide()
and newForm().ShowDialog()
as J.N. mentioned, ShowDialog will work, but I think you will need to have your processing code in the new form you open up, as the program will only return and 'unlock' your main form after the new form has finished and closed.
Edit I just saw the comments below the original post, I guess this has been sorted, but I'll leave my comments above just in case
精彩评论