My guess, without checking (late, lazy, sorry), and assuming frmReference is
global, is that
the form is disposed whilst closing so you have a reference in your parent
wich is not null but
the child form is gone (handles freed, memory in garbage, etc ...).
Why not pass a parent reference to the child form and when the child closes
down it notifies its parent of
it's closure, where the parent resets the child reference to null (so it can
be reconstructed with your button
click) ?
AinO.
PS. Specifying the error message does wonders (i was not very specific
myself, i know so 1-1).
"ywchan" <yw****@gmail.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
when i press a button, a form.Show is triggered
the form provides some reference information for me to input information
in the parent form, so i don't want to use ShowDialog.
besides, i want the form to opened once only
how can i do this?
i use
form1 frmReference;
if (frmReference == null)
{
frmReference = new form1();
}
frmReference.Show();
I can successfully control a form to be opened once only
but when i close the form, and press the button again...
there is error encountered....
thanks!