Wait Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to amend someone else's code. He had a user control pop up
as modal so that the user can not access the main app till he is done
with the user control. I have had to change the form from being modal
so that the user can access help and the user control, while not
accessing the main app. The problem that I am having now is that the
previous developer had code after the userControl.ShowModal() that
needs to be done, but not till after the user is done with the user
control. How can I go about having the main app wait till the user
control is done without using ShowModal()? The code is in the session
controller between the main app and the user control and is something
like this:

Execute (UserControl UserControlName)
{
UserControlName.Show()

DialogResult dr = UserControlName.rDialogResult; // if the user preses
ok I set it = ok, etc.
if (dr = DialogResult.OK)
{
Do a bunch of stuff on the main application for based on the results
}

else
{
Quit, learn to knit, or something
}

Any idea of how to simlate a wait till the user has finished his
business with the UserControl?

Thanks,
Susan
 
If you have to make it modeless, how about having the form raise an event
depending on what is clicked. You can add two events to the form, OK and
Cancel, and raise them accordingly. On the event handler, run the code that
used to appear after the call to ShowModal.
 
Back
Top