Setting DialogResult dosen't close a form

T

Thore Berntsen

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
 
J

jayderk

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!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top