yohan.jayarathna
yohan.jayarathna

Reputation: 3453

C# Forms: Lock Main form and process another form

I want to create something like this.

enter image description here

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 load the another form.

How can I do this ?

Please Help Yohan

Upvotes: 0

Views: 2605

Answers (3)

EdmundYeung99
EdmundYeung99

Reputation: 2511

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

Upvotes: 1

Kumar
Kumar

Reputation: 1015

oldForm.Hide() and newForm().ShowDialog()

Upvotes: 1

J.N.
J.N.

Reputation: 8421

new Form().ShowDialog() will do just that.

Upvotes: 3

Related Questions