I'm a web developer who has been forced to take on a gui program for whatever reason and I've run into some trouble.

I have a program that loops through a directory of files and opens up a new form if the user needs to perform an action on that file. The problem is that I don't know how to stop the while loop until that new form is closed, so I end up with a bunch of open forms.

I tried doing a while loop using !form2.IsDisposed, but that just crashes the new form. Search has come up empty for me.

Any ideas?



Why dont you try to show the new form Modally NewForm.ShowDialog (); Also NewForm.ShowDialog ( ownerForm ); Now NewForm will show modally.