I have an application that has a Form that is shown using the ShowDialog
method. I try to close it using this statement : this.DialogResult =
DialogResult.OK;

This works fine moste of the time. But sometimes the form will not close. I
do not use any of the Close events on the form.

The form does not du much. I't just collects at string in a textBox
controll.

Do anyone have any idea on what might be the cause of this problem?

Thore Berntsen
Norway

Re: Setting DialogResult dosen't close a form by jayderk

jayderk
Fri Dec 19 12:34:36 CST 2003

Thore,
Changing the DialogResult to DialogResult.OK does not envoke the close
event.
How is your app closing?

private void thisForm.Closing(events......)
{
if(this happened)
this.DialogResult = DialogResult.OK;
else if(that happened)
this.DialogResult = DialogResult.Cancel;
else
this.DialogResult = null;
}
is the way I close my forms........
rememeber to dispose the form object when you are done!!!!!


"Thore Berntsen" <thbernt@hotmail.com> wrote in message
news:e4zunDlxDHA.1272@TK2MSFTNGP12.phx.gbl...
> I have an application that has a Form that is shown using the ShowDialog
> method. I try to close it using this statement : this.DialogResult =
> DialogResult.OK;
>
> This works fine moste of the time. But sometimes the form will not close.
I
> do not use any of the Close events on the form.
>
> The form does not du much. I't just collects at string in a textBox
> controll.
>
> Do anyone have any idea on what might be the cause of this problem?
>
> Thore Berntsen
> Norway
>
>